MAMP MySQL无法启动。

4
我有一个MySQL服务器的问题。当我启动MAMP时,MySQL服务器无法启动。我尝试更改端口,但没有帮助。我检查了错误日志,在那里我发现了这个:
161010 09:21:07 mysqld_safe Starting mysqld daemon with databases from /Applications/MAMP/db/mysql56
2016-10-10 09:21:07 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-10-10 09:21:07 0 [Note] /Applications/MAMP/Library/bin/mysqld (mysqld 5.6.28) starting as process 6633 ...
2016-10-10 09:21:07 6633 [Warning] Setting lower_case_table_names=2 because file system for /Applications/MAMP/db/mysql56/ is case insensitive
2016-10-10 09:21:07 6633 [Note] Plugin 'FEDERATED' is disabled.
/Applications/MAMP/Library/bin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13 - Permission denied)
2016-10-10 09:21:07 6633 [ERROR] Can't open the mysql.plugin table.    Please run mysql_upgrade to create it.
2016-10-10 09:21:07 6633 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-10-10 09:21:07 6633 [Note] InnoDB: The InnoDB memory heap is disabled
2016-10-10 09:21:07 6633 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-10-10 09:21:07 6633 [Note] InnoDB: Memory barrier is not used
2016-10-10 09:21:07 6633 [Note] InnoDB: Compressed tables use zlib 1.2.8
2016-10-10 09:21:07 6633 [Note] InnoDB: Using CPU crc32 instructions
2016-10-10 09:21:07 6633 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-10-10 09:21:07 6633 [Note] InnoDB: Completed initialization of buffer pool
2016-10-10 09:21:07 6633 [Note] InnoDB: Highest supported file format is Barracuda.
2016-10-10 09:21:07 6633 [Note] InnoDB: 128 rollback segment(s) are active.
2016-10-10 09:21:07 6633 [Note] InnoDB: Waiting for purge to start
2016-10-10 09:21:07 6633 [Note] InnoDB: 5.6.28 started; log sequence number 1600617
2016-10-10 09:21:07 6633 [Note] RSA private key file not found: /Applications/MAMP/db/mysql56//private_key.pem. Some authentication plugins will not work.
2016-10-10 09:21:07 6633 [Note] RSA public key file not found: /Applications/MAMP/db/mysql56//public_key.pem. Some authentication plugins will not work.
2016-10-10 09:21:07 6633 [Note] Server hostname (bind-address): '*'; port: 3308
2016-10-10 09:21:07 6633 [Note] IPv6 is available.
2016-10-10 09:21:07 6633 [Note]   - '::' resolves to '::';
2016-10-10 09:21:07 6633 [Note] Server socket created on IP: '::'.
2016-10-10 09:21:07 6633 [ERROR] /Applications/MAMP/Library/bin/mysqld:  Can't find file: './mysql/user.frm' (errno: 13 - Permission denied)
2016-10-10 09:21:07 6633 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/user.frm' (errno: 13 - Permission denied)
161010 09:21:07 mysqld_safe mysqld from pid file   /Applications/MAMP/tmp/mysql/mysql.pid ended

我希望有人能够帮助我解决这个问题。
2个回答

5

我不知道这是否是你的问题,但我尝试使用killall -9 mysqld 杀死mysqld,并尝试在活动监视器中查找运行的mysqld,但它并不存在。

最终我解决了问题:在问题出现之前,有一个mysqldump被中断了。这导致表空间损坏。所以我退出并重新启动了MAMP PRO(服务器未设置为自动启动)。然后使用MAMP的“文件”>“编辑模板”更改了my.cnf。并添加了一行innodb_force_recovery = 1。之后服务器可以正常启动。修复后我注释掉了那行代码。


非常感谢!在升级到macOS Sierra后,再从MAMP 3.x升级到4.1.x后遇到了困难。将innodb_force_recovery = 1添加到my.cnf中即可解决问题。提示:添加后保存文件,然后killall -9 mysqld,最后重新启动MAMP并启动服务器。我曾经尝试过其他顺序,但都没有成功,如果有人对这个解决方案放弃得太早,请参考我的做法。 - jerclarke
谢谢,这对我有用。只是需要注意,在最新版本的MAMP中,您需要将其设置为innodb_force_recovery = 2,否则它将无法正常工作。再次感谢。 - Georgi Kirilov
嗨,我有这个问题,但是我找不到my.cnf文件。它的位置在哪里?@BruceClothier 谢谢 - user3242861

2
将MAMP/db/mysql56文件夹中所有的ib_logfileN(N是数字)重命名为tmp_ib_logfileN。 然后重新启动MAMP。 享受!

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接