在Snow Leopard上,启动MySQL会出现以下错误。
服务器没有更新PID文件就退出了
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16K
pid-file=/var/run/mysqld/mysqld.pid
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
尝试找到后缀为".err"的日志文件,应该有更多信息。它可能在。
/usr/local/var/mysql/your_computer_name.local.err
这可能是权限的问题
1.检查是否有mysql实例正在运行
ps -ef | grep mysql
如果是,你应该停止它,或者杀死这个进程
kill -9 PID
其中PID
是前一条命令输出中显示在用户名旁边的数字
/usr/local/var/mysql/
的所有权ls -laF /usr/local/var/mysql/的所有权。
如果它的所有者是root',你应该把它改为
mysql'或`your_user'。
sudo chown -R mysql /usr/local/var/mysql/
我希望这对你有用。
在检查了错误日志后,我发现了这个。
120309 17:42:49 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
120309 17:42:50 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
120309 17:42:50 [Warning] You need to use --log-bin to make --binlog-format work.
120309 17:42:50 [Note] Plugin 'FEDERATED' is disabled.
120309 17:42:50 InnoDB: The InnoDB memory heap is disabled
120309 17:42:50 InnoDB: Mutexes and rw_locks use GCC atomic builtins
120309 17:42:50 InnoDB: Compressed tables use zlib 1.2.3
120309 17:42:50 InnoDB: Initializing buffer pool, size = 16.0M
120309 17:42:50 InnoDB: Completed initialization of buffer pool
120309 17:42:50 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 /usr/local/mysql/data/ib_logfile0
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
120309 17:42:50 mysqld_safe mysqld from pid file /usr/local/mysql/data/lu1s.local.pid ended
为了解决这个问题,我给了整个mysql文件夹的所有权。
cd /usr/local
sudo chown mysql mysql
sudo chown mysql mysql-5.5.21-osx10.6-x86_64
sudo chown _mysql mysql
sudo chown _mysql mysql-5.5.21-osx10.6-x86_64
然后(你也可以用命令行来做),我在/usr/local/mysql-5.5.21-osx10.6-x86_64的文件夹的"get info"菜单中,将权限(一旦我给了_mysql和mysql用户的所有权)应用到所有封闭的文件夹。你不需要在别名中加入这些内容,因为它只是一个别名。
文件夹的名称取决于你所安装的mysql的版本。