无法在新安装的 MAMP 上启动 MySQL 服务器

无法在新安装的 MAMP 上启动 MySQL 服务器

我在我的 Macbook Pro 上使用 Mac OS X 10.6.2。

我可以在默认 apache 和默认 MAMP 端口上启动 apache 服务器,但无法启动 mysql 服务器。当我尝试转到我的开始页面时,我收到消息“错误:无法连接到 MySQL 服务器!”。以下是我的 mysql 错误日志中的内容:

00513 02:00:07 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended
100513 02:00:16 mysqld_safe Starting mysqld daemon with databases from /Applications/MAMP/db/mysql
100513 2:00:16 [Warning] The syntax '--log_slow_queries' is deprecated and will be removed in a future release. Please use '--slow_query_log'/'--slow_query_log_file' instead.
100513 2:00:16 [Warning] You have forced lower_case_table_names to 0 through a command-line option, even though your file system '/Applications/MAMP/db/mysql/' is case insensitive. This means that you can corrupt a MyISAM table by accessing it with different cases. You should consider changing lower_case_table_names to 1 or 2
100513 2:00:16 [Warning] One can only use the --user switch if running as root
100513 2:00:16 [Note] Plugin 'FEDERATED' is disabled.
100513 2:00:16 [Note] Plugin 'ndbcluster' is disabled.
InnoDB: Error: log file /usr/local/mysql/data/ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 16777216 bytes!
100513 2:00:16 [ERROR] Plugin 'InnoDB' init function returned error.
100513 2:00:16 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
100513 2:00:16 [ERROR] /Applications/MAMP/Library/libexec/mysqld: unknown option '--skip-bdb'
100513 2:00:16 [ERROR] Aborting
100513 2:00:16 [Note] /Applications/MAMP/Library/libexec/mysqld: Shutdown complete
100513 02:00:16 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended

有几件事:

1) MAMP 附带了许多不同的 .cnf 文件(my-huge、my-medium 等)...我如何知道实际正在使用哪一个?
2) 我按照 serverfault 上另一篇文章的建议删除了 ib_logfile0 和 ib_logfile1,然后出现了更多错误:

100519 16:01:30  InnoDB: Log file /usr/local/mysql/data/ib_logfile0 did not exist: new to be created
InnoDB: Setting log file /usr/local/mysql/data/ib_logfile0 size to 16 MB
InnoDB: Database physically writes the file full: wait...
100519 16:01:30  InnoDB: Log file /usr/local/mysql/data/ib_logfile1 did not exist: new to be created
InnoDB: Setting log file /usr/local/mysql/data/ib_logfile1 size to 16 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
100519 16:01:31  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
100519 16:01:31  InnoDB: Started; log sequence number 0 44556
100519 16:01:31 [ERROR] /Applications/MAMP/Library/libexec/mysqld: unknown option '--skip-bdb'
100519 16:01:31 [ERROR] Aborting

然后当我下次尝试运行它时,我得到了这个:

InnoDB: Unable to lock /usr/local/mysql/data/ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process 
InnoDB: using the same InnoDB data or log files.

抱歉,信息量有点大,但我不想遗漏任何内容。谢谢。

答案1

这听起来绝对像是您有很多 MySQL 进程正在运行,您只需退出所有 mysql 进程,然后启动 MySQL。打开您的终端并发出:

kill -s 15 `http://softwaregravy.wordpress.com/2010/10/16/ls-colors-for-mac/`

确认:

ps -ef | grep mysql | grep -v grep

如果仍然有进程出现,则需要强制终止所有进程:

kill -s 9 `http://softwaregravy.wordpress.com/2010/10/16/ls-colors-for-mac/`

确认,然后像平常一样通过 MAMP 的控制面板启动 MySQL。

答案2

我遇到了类似的问题,我注意到重新启动计算机后,mysql 无法启动,当我退出 MAMP 然后尝试再次启动它时,只有 Apache 启动......

对我有用的“修复”是退出 MAMP,使用活动监视器退出“mysqld”的所有实例,然后重新启动 MAMP。

相关内容