在Mac OS X v10.6 (Snow Leopard)上,启动MySQL会出现以下错误:

服务器退出,没有更新PID文件

文件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

当前回答

删除*。在错误提示的目录中找到的错误文件,创建MySQL所抱怨的文件,并重新启动MySQL。

其他回答

尝试查找后缀为“.err”的日志文件。应该有更多的信息。它可能在:

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

可能是权限有问题

检查是否有MySQL实例正在运行 Ps -ef | grep mysql 如果是,你应该停止它,或者终止进程: kill -9 PID 其中PID是显示在前一个命令输出的用户名旁边的数字 检查/usr/local/var/mysql/的所有权 ls -laF /usr/local/var/mysql/ 如果它是root的owner,你应该把它改为mysql或your_user sudo chown -R mysql /usr/local/var/mysql/

试试这个…

导航到问题的父目录cd YOURPATH/usr/local/mysql Rm -rf *.local。Err(删除文件) touch YOURUSERNAME.local.pid(生成新的*.local. pid。错误抛出的Pid文件正在抱怨) “cd”回到你的项目,并重新启动MySQL使用MySQL。服务器启动

对我来说,我必须重新安装MySQL:

brew reinstall mysql

然后按下面的命令启动MySQL,在登录时重新启动:

brew services start mysql

当MySQL被不正确地关闭后试图启动MySQL时,可能会发生此错误。

Take a look at the MySQL error log file. If it mentions something like "Check that you do not already have another mysqld process using the same data or log files.", then you need to properly shutdown that process. See what process MySQL is running on. Use the command lsof -i:3306 (the default port number for MySQL is 3306). Your output should look like this: COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME mysqld 4249 username 17u IPv4 0x7843d9d130469c0b 0t0 TCP localhost:mysql (LISTEN) Terminate the process running mysql: kill -15 4249 Kill -15 sends a signal to the process to free up any resources it is locking and terminate the process after. Now MySQL should start up with no problems: mysql.server start

我的错误文件还告诉我,端口可能正在被另一个进程使用,但只是运行sudo mysql。服务器启动修复了我的问题。