MySql服务器启动错误“服务器退出但未更新PID文件"

问题描述:

在Snow Leopard上,启动MySQL会出现以下错误:

On Snow Leopard, starting MySQL gives the following error:

服务器退出而不更新PID文件

The server quit without updating PID file

my.cnf

[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"的日志文件,应该有更多信息.可能在:

try to find your log file with suffix ".err", there should be more info. It might be in:

/usr/local/var/mysql/your_computer_name.local.err

/usr/local/var/mysql/your_computer_name.local.err

权限可能有问题

  1. 检查是否有任何mysql实例正在运行

  1. check if any mysql instance is running

ps -ef | grep mysql

ps -ef | grep mysql

如果是,则应停止它,或终止该进程

if yes, you should stop it, or kill the process

杀死-9 PID

kill -9 PID

其中PID是上一个命令的输出中用户名旁边显示的数字

where PID is the number displayed next to username on output of previous command

检查/usr/local/var/mysql/

ls -laF/usr/local/var/mysql/

ls -laF /usr/local/var/mysql/

如果它是root的所有者,则应将其更改为mysqlyour_user

if it is owner by root you should change it mysql or your_user

sudo chown -R mysql/usr/local/var/mysql/

sudo chown -R mysql /usr/local/var/mysql/