在Mac上装Mysql启动不了


我的系统是 OS X 10.8.2,从mysql官网下载了Mac OS X版本的MySQL包,mysql-5.5.28-osx10.6-x86_64
然后复制到

# sudo cp -r ~/mysql-5.5.28-osx10.6-x86_64 /usr/local/mysql-5.5.28

建一个软连接

# sudo ln -s /usr/local/mysql-5.5.28
# ls -l mysql
lrwxr-xr-x  1 root  wheel    12B Nov  3 15:59 mysql -> mysql-5.5.28

我先用mysqld启动,报错

# sudo ./mysqld
121106 17:07:44 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql-5.5.28/data/ is case insensitive
121106 17:07:44 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!

121106 17:07:44 [ERROR] Aborting

121106 17:07:44 [Note] ./mysqld: Shutdown complete

然后我用mysqld_safe启动

>sudo ./mysqld_safe 
121106 17:11:46 mysqld_safe Logging to '/usr/local/mysql/data/dev.local.err'.
121106 17:11:46 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
121106 17:11:46 mysqld_safe mysqld from pid file /usr/local/mysql/data/dev.local.pid ended

还是失败。。。无奈了,这个不是编译好的包么?还需要额外干什么吗?

这个是 dev.local.err的文件内容:

121106 21:07:22 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
121106 21:07:22 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
121106 21:07:22 [Note] Plugin 'FEDERATED' is disabled.
/usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist
121106 21:07:22 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
121106 21:07:22 InnoDB: The InnoDB memory heap is disabled
121106 21:07:22 InnoDB: Mutexes and rw_locks use GCC atomic builtins
121106 21:07:22 InnoDB: Compressed tables use zlib 1.2.3
121106 21:07:22 InnoDB: Initializing buffer pool, size = 128.0M
121106 21:07:22 InnoDB: Completed initialization of buffer pool
121106 21:07:22  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.
121106 21:07:22 mysqld_safe mysqld from pid file /usr/local/mysql/data/dev.local.pid ended

mysql macosx

TSink. 11 years, 7 months ago

从dev.local.err可以看出来,由于你没有给mysqld_safe指定配置文件,它用了默认路径 “/usr/local/mysql/data” 作为数据文件的路径。该路径很可能没有被创建,所以导致错误。

建议是参照包里给出的my.cnf(my-small.cnf等)修改,然后执行mysqld_safe的时候指定。

暗夜的眷属 answered 11 years, 7 months ago

Your Answer