在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时,可能会发生此错误。

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

其他回答

open /usr/local/var/mysql

你只需要删除Finder中的文件夹,然后

brew install mysql

再次安装。

从这个解解出来的。

但是这个解决方案会删除数据库。

我也有同样的问题。原因很简单。我安装了两个MySQL服务器。一个来自MacPorts,另一个来自下载的包。所以我只是按照这里的说明,从包中卸载了一个。

如何从Mac OS X上卸载MySQL ?

在那之后,MySQL运行得很好。

在我的情况下,我得到了这个问题在一个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

将日志文件“ib_logfile”移到“/var/lib/mysql”目录下,重启mysql。有时mysql会失败,因为它面临更新日志文件的困难

mv /var/lib/mysql/ib_logfile* /some/tmp/folder/

你也可以删除ib_logfile,因为它会在mysql重启后自动创建

现在重启mysql服务器

我必须在安全模式下检查我的错误文件,以找到根本原因:

Rm -f /usr/local/var/mysql/*.err mysqld_safe开始 猫mysql / * .err

这显示了升级例程中的一个错误。我试着修复它,但我在网上找不到足够的信息。在那之后,我放弃了,并手动导出数据库:

mysql。server start——upgrade=MINIMAL,因此服务器将启动 mysqldump不会工作,因为它会尝试运行完整的升级,但你可以使用Sequel Pro, phpMyAdmin等来导出。 停止服务器,将mysql文件夹重命名为mysql。坏了,并做一个干净的安装,以获得一个新的mysql文件夹。 启动MySQL,手动导入前面导出的.sql文件。