在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

当前回答

尝试删除ib_logfile0和ib_logfile1文件,然后再次运行MySQL:

rm /usr/local/var/mysql/ib_logfile0
rm /usr/local/var/mysql/ib_logfile1

这对我很管用。

其他回答

我试图重新安装MySQL,实际上我忘记停止服务器从我的旧安装。要解决这个问题,ps -ax | grep mysql并杀死[任何pid]。但话说回来,每个人都不一样。就像其他答案说的,转到/usr/local/var/mysql/并检查你的.err日志文件。

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

ps auxf | grep mysql

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

我试着去掉所有的*。err文件,但我仍然得到相同的错误。我在错误日志中得到了一个错误:

InnoDB:试图打开先前打开的表空间。以前的表空间“erp/brand”在文件路径:./erp/brand.ibd下使用了“ID: 7”的空间。在“filepath: ./webdb1/system_ user.ibd”目录下,无法打开ID为7的表空间“webdb1/system_user”

所以我删除了所有的ib*文件,它工作:

rm -f *.err ib*

我使用

全新的MacBook Pro,搭载OS X v10.7.3操作系统。x(狮子) 通过OS X GCC安装程序

我使用Homebrew ('brew install MySQL ')安装MySQL。它安装了几个依赖项,然后安装了MySQL。

当我试着启动它时,

mysql.server start

Starting MySQL
.. ERROR! The server quit without updating PID file (/usr/local/var/mysql/west.local.pid).

我执行这个命令,

/usr/local/Cellar/mysql/5.5.25/scripts/mysql_install_db

和MySQL工作。

请注意,您需要从MySQL目录的顶层运行mysql_install_db(例如,usr/local/Cellar/ MySQL /5.5.25)。直接在/scripts目录中运行它并不能为它提供足够的上下文来运行它。

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