mysql没有在mamp上启动

时间:2017-01-19 00:06:43

标签: mysql apache mamp

我已经使用MAMP了很长一段时间,但几个月前它开始给我带来问题。我已经通过谷歌搜索和堆栈溢出在线查找解决方案,但我还没有看到任何可以帮助我的东西。

我已经搜索了一些文章,但我觉得这些文章已经接近帮助我了:

MAMP mysql not starting 我不确定数据目录的路径?我在终端中输入的任何内容似乎都会以未找到的命令返回

Mysql service won't start, InnoDB init function error

MAMP mysql server won't start. No mysql processes are running 我试图killall,但“没有找到属于你的匹配进程”错误显示

大约一个小时前我的mqsql工作但不是apache,所以我发现文章说要将Library / bin / envvars重命名为_envvars,apache在启动时工作但是mysql没有。

我的php日志中没有出现任何错误,但这是我的apache和mysql日志。

这是mysql错误日志底部的片段

InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
170118 15:52:39  InnoDB: Unable to open the first data file
InnoDB: Error in opening ./ibdata1
170118 15:52:39  InnoDB: Operating system error number 35 in a file operation.
InnoDB: Error number 35 means 'Resource temporarily unavailable'.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/operating-system-error-codes.html
170118 15:52:39 InnoDB: Could not open or create data files.
170118 15:52:39 InnoDB: If you tried to add new data files, and it failed here,
170118 15:52:39 InnoDB: you should now edit innodb_data_file_path in my.cnf back
170118 15:52:39 InnoDB: to what it was, and remove the new ibdata files InnoDB created
170118 15:52:39 InnoDB: in this failed attempt. InnoDB only wrote those files full of
170118 15:52:39 InnoDB: zeros, but did not yet use them in any way. But be careful: do not
170118 15:52:39 InnoDB: remove old data files which contain your precious data!
170118 15:52:39 [ERROR] Plugin 'InnoDB' init function returned error.
170118 15:52:39 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
170118 15:52:39 [ERROR] Unknown/unsupported storage engine: InnoDB
170118 15:52:39 [ERROR] Aborting

170118 15:52:39 [Note] /Applications/MAMP/Library/bin/mysqld: Shutdown complete

170118 15:52:39 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended

然后是apache错误日志

[Wed Jan 18 15:48:28 2017] [notice] Digest: generating secret for digest authentication ...
[Wed Jan 18 15:48:28 2017] [notice] Digest: done
[Wed Jan 18 15:48:28 2017] [notice] Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8zh DAV/2 PHP/5.3.6 configured -- resuming normal operations
[Wed Jan 18 15:48:31 2017] [notice] caught SIGTERM, shutting down
[Wed Jan 18 15:51:01 2017] [notice] Digest: generating secret for digest authentication ...
[Wed Jan 18 15:51:01 2017] [notice] Digest: done
[Wed Jan 18 15:51:01 2017] [notice] Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8zh DAV/2 PHP/5.3.6 configured -- resuming normal operations

我的端口是:apache 80和mysql 3306。

如果有人可能知道会发生什么事情会让人感到惊讶......

6 个答案:

答案 0 :(得分:2)

回到十二月,当我在Mac上遇到同样的问题时,我进行了一些探索并找到了一个非常简单的解决方案:

  1. 退出MAMP
  2. 在finder中,转到Applications / MAMP / db / mysql56 /并删除最后一个日志文件,在我的例子中是ib_logfile1。 (在删除之前备份此文件可能是个好主意,或者将其移动到其他位置而不是删除它。)
  3. 重启MAMP。就是这样!
  4. 有些人报告说删除ib_logfile0也是必要的,但不是我的情况。您可以在去年我首次发布解决方案的JuanFra.me博客中查看此内容。

    我不知道这个解决方案为何或如何运作,但似乎它对许多其他人有帮助,正如JuanFra的博客中所报告的那样。我希望它对你也有用。

答案 1 :(得分:0)

  • 目前正在运行的MySQL / MariaDB的另一个副本?
  • ibdata1在一些奇怪的文件系统分区上?

答案 2 :(得分:0)

您是否偶然从已启动的实例中恢复备份?

以下内容摘自https://dev.mysql.com/doc/refman/5.7/en/backup-types.html

物理备份方法具有以下特征:    •可以在MySQL服务器未运行时执行备份。如果服务器正在运行,则必须执行适当的锁定,以便服务器在备份期间不会更改数据库内容。 MySQL Enterprise Backup会自动为需要它的表执行此锁定。

答案 3 :(得分:0)

停止MySQL根据您是使用官方二进制安装程序,使用MacPorts还是使用Homebrew安装MySQL,有不同的情况: MacPorts的

sudo launchctl unload -w /Library/LaunchDaemons/org.macports.mysql.plist
sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql.plist

注意:重启后这是持久的。 自制

launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

二进制安装程序

sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
sudo /Library/StartupItems/MySQLCOM/MySQLCOM restart

答案 4 :(得分:0)

如果MySQL没有启动它很可能已经在运行了。您可以非常轻松地在终端中手动关闭它。

我曾经多次发生过这种情况,我认为这与未正确关闭MAMP有关。

  1. 退出MAMP。
  2. 打开终端并输入:killall -9 mysqld
  3. 重启MAMP。

答案 5 :(得分:0)

  1. 退出MAMP
  2. 转到/ Applications / MAMP / tmp / mysql /并添加文件
  3. 重新启动MAMP。就是这样!