在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

当前回答

在我的情况下,我得到了这个问题在一个VPS和cPanel。

我试了之前的大部分答案,但都没有成功。

check where your error log is. It would be mentioned at the end of the error line. ERROR! The server quit without updating PID file (/var/lib/mysql/111318.vps-11.com.pid). Open that file (/var/lib/mysql/111318.vps-11.com.err) and check the bottom for the latest lines. In my case, there is [ERROR] Fatal error: Can't open and lock privilege tables: Table './mysql/db' is marked as crashed and should be repaired How solve this: Recovering and fixing the table indexes by command: [~]# myisamchk -r /var/lib/mysql/mysql/db.MYI MySQL is not running (Re)Start your MySQL server

其他回答

似乎MySQL进程正在运行,因此您无法使用端口。用于查看正在运行的MySQL进程。

ps auxf | grep mysql

如果你得到任何MySQL进程,使用kill -9 PID杀死该进程ID,然后尝试启动MySQL。

⚠️这将删除您的数据,所以请确保它首先备份。

如果没有人帮助你,只需删除/usr/local/var/mysql文件夹,然后使用brew重新安装MySQL。

在/etc/ SELinux /config:

SELINUX=禁用并重新启动服务器。

试着用 sudo rm -rf /usr/local/var/mysql/ hostnameerr (HOSTNAME是我的主机名)

我在Mac OS X v10.7.5 (Lion)上尝试升级时遇到了这个问题。

不幸的是,MySQL也从5.5.14升级到5.6.10。我尝试了新版本,但它不起作用。

我决定回到我以前的设置,做了一个

brew switch mysql 5.5.14

这并没有解决问题。我在其他地方阅读并这样做了,瞧!一切都回来了:)

cd /usr/local/var/mysql
mv ib_logfile0 ib_logfile0.bak
mv ib_logfile1 ib_logfile1.bak