MAMP - MySQL 启动失败

在使用MAMP的过程中,有时会碰到 MySQL 服务无法启动的现象,这种原因多数是由于端口冲突或己存在MySQL进程造成的。端口冲突可以使用端口查看工具进行查看,进程冲突可在终端中使用“ps aux | grep mysq*”命令查看是否存在MySQL的进程。如有:使用“Kill”命令终止被占用的MySQL进程。具体方法如下:

MAMP 的日志参考信息如下:

2017-10-22 08:58:35 30689 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2017-10-22 08:58:36 30689 [ERROR] InnoDB: Unable to lock /Library/Application Support/appsolute/MAMP PRO/db/mysql56/ibdata1, error: 35
2017-10-22 08:58:36 30689 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
# 检查是否有相同的InnoDB数据或日志文件的另一个相同的进程。
2017-10-22 08:58:36 30689 [Note] InnoDB: Unable to open the first data file  //无法打开第一个数据文件
2017-10-22 08:58:36 7fffb74fa340  InnoDB: Operating system error number 35 in a file operation.  //在文件操作中操作系统错误代码 35
InnoDB: Error number 35 means 'Resource temporarily unavailable'.   //错误号35表示“资源暂时不可用”。
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/operating-system-error-codes.html
2017-10-22 08:58:36 30689 [ERROR] InnoDB: Can't open '/Library/Application Support/appsolute/MAMP PRO/db/mysql56/ibdata1'
2017-10-22 08:58:36 30689 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
2017-10-22 08:58:36 30689 [ERROR] Plugin 'InnoDB' init function returned error.
2017-10-22 08:58:36 30689 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-10-22 08:58:36 30689 [ERROR] Unknown/unsupported storage engine: InnoDB
2017-10-22 08:58:36 30689 [ERROR] Aborting

问题分析:出现这类错误的原因,看InnoDB的日志提示可以得出应为其他的线程启动已经在运行,无法再次创建相关的读文件进程的权限,也就是说,现有的ibddata1文件已经有人读取了,无法再次启动!我们通过以下命令来查找是否如错误提示中所言;

打开终端:[⌘+空格,输入terminal.app & 回车运行]

**MacBook-Pro:~ user$ ps aux | grep mysq* //查看关于mysq*的相关进程,这里的mysq*也可以是mysql。*为通配符!~
user        31204   0.0  0.0  4268792    900 s000  S+    9:02上午   0:00.00 grep mysql
user        29263   0.0  0.8  4655528 142592   ??  S     8:53上午   0:00.40 /Applications/MAMP/Library/bin/mysqld --defaults-file=/Applications/MAMP/tmp/mysql/my.cnf --basedir=/Applications/MAMP/Library --datadir=/Library/Application Support/appsolute/MAMP PRO/db/mysql56 --plugin-dir=/Applications/MAMP/Library/lib/plugin --tmpdir=/Applications/MAMP/tmp/mysql/tmpdir --log-error=/Applications/MAMP/logs/mysql_error.log --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --socket=/Applications/MAMP/tmp/mysql/mysql.sock --port=3306
user        28359   0.0  0.0  4291904   1308   ??  S     8:53上午   0:00.06 /bin/sh /Applications/MAMP/Library/bin/mysqld_safe --defaults-file=/Applications/MAMP/tmp/mysql/my.cnf --port=3306 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --user=wangweida --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error=/Applications/MAMP/logs/mysql_error.log --tmpdir=/Applications/MAMP/tmp/mysql/tmpdir --datadir=/Library/Application Support/appsolute/MAMP PRO/db/mysql56
#这里使用kill命令将进程终止掉,再重新启动MAMP的MySQL服务即可。
**MacBook-Pro:~ user$ kill 29263
**MacBook-Pro:~ user$ kill 28359

 

点赞

发表评论

电子邮件地址不会被公开。必填项已用 * 标注