MAMP 上的 Mysql 服务器无法启动

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41309275/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 22:07:45  来源:igfitidea点击:

Mysql server on MAMP won't start

mysqlmamp

提问by Inas

My Mysql server on MAMP won't start. This is the error:

MAMP 上的 Mysql 服务器无法启动。这是错误:

161224 00:15:00 mysqld_safe Logging to '/Applications/MAMP/logs/mysql_error_log.err'. 161224 00:15:00 mysqld_safe Starting mysqld daemon with databases from /Applications/MAMP/db/mysql56 161224 00:15:01 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended

161224 00:15:00 mysqld_safe 登录到“/Applications/MAMP/logs/mysql_error_log.err”。161224 00:15:00 mysqld_safe 使用 /Applications/MAMP/db/mysql56 中的数据库启动 mysqld 守护进程 161224 00:15:01 mysqld_safe mysqld 来自 pid 文件 /Applications/MAMP/tmp/mysql/mysql.pid 结束

I already tried the following commands:

我已经尝试了以下命令:

> ps aux | grep mysql
> lsof -i
> sudo killall -9 mysqld

But the server is still not working.

但是服务器仍然无法正常工作。

Help ?

帮助 ?

回答by A R

Remove the files ib_logfileN(Nbeing the number) from the MAMP/db/mysql56folder.

从文件夹中删除文件ib_logfileNN是数字)MAMP/db/mysql56

Then restart MAMP.

然后重新启动 MAMP。

Should Work!!

应该管用!!

Edit: If the above step doesn't work completely, please remove the ibdata<n>file as well, based on the comments.

编辑:如果上述步骤不能完全奏效,请ibdata<n>根据评论删除该文件。

回答by S.Yadav

I am working on oS-X (Mac), I was wondering around and came to see this postwhich help me a lot.
Many readers are being able to solve this problem thanks to the amazing here are the step to fix it out--

我正在 os-X (Mac) 上工作,我四处闲逛,然后看到这篇对我有很大帮助的帖子
许多读者能够解决这个问题,这要归功于以下惊人的解决步骤——

This issue generally occur due to explicitly closing of MAMP serves.

此问题通常是由于显式关闭 MAMP 服务而发生的。

  1. Quit MAMP.
  2. In the finder go to Applications/MAMP/db/mysql/
  3. Delete the last log file (look for a file named ib_logfileN – being N the log number Eg-ib_logfile0 and ib_logfile1)we can see in below image.
  1. 退出 MAMP。
  2. 在取景器中转到 Applications/MAMP/db/mysql/
  3. 删除最后一个日志文件(查找名为 ib_logfileN 的文件——N 是日志号,例如-ib_logfile0 和 ib_logfile1我们可以在下图中看到。

enter image description here

在此处输入图片说明

  1. Please back up these before you delete them.
  2. Restart MAMP.
  1. 请在删除它们之前备份它们。
  2. 重新启动 MAMP。

It Worked for me, hope will work for you too..

它对我有用,希望对你也有用..

回答by zeeawan

I killed the process mysqlidvia Activity Monitoron MacOS and restarted MAMP and MySql run successfully.

我通过MacOS上的Activity Monitor杀死了进程mysqlid并重新启动了 MAMP 和 MySql 运行成功。

Update:Even this solution works without restarting MAMP.

更新:即使这个解决方案也可以在不重新启动 MAMP 的情况下工作

回答by AEQ

My MAMPs MySQL stopped working after a power failure, this worked for me:

我的 MAMPs MySQL 在断电后停止工作,这对我有用:

  1. Stop servers from terminal

    • cd /Applications/MAMP/bin
    • ./stop.sh
  2. Create my.cnf file in /Applications/MAMP/conf with the following: [mysqld] innodb_force_recovery = 1

  3. Start MySQL from same terminal window.

    • ./startMysql.sh
  4. Stop MySQL once it has recovered (Check the log in /Applications/MAMP/logs/mysql_error_log.err).

    • ./stopMysql.sh
  5. Remove the lines from my.cnf, save and start the servers as usual from the MAMP app.

  1. 从终端停止服务器

    • cd /应用程序/MAMP/bin
    • ./stop.sh
  2. 使用以下内容在 /Applications/MAMP/conf 中创建 my.cnf 文件: [mysqld] innodb_force_recovery = 1

  3. 从同一终端窗口启动 MySQL。

    • ./startMysql.sh
  4. 一旦 MySQL 恢复,就停止它(检查 /Applications/MAMP/logs/mysql_error_log.err 中的日志)。

    • ./stopMysql.sh
  5. 从 my.cnf 中删除行,像往常一样从 MAMP 应用程序保存并启动服务器。

回答by Soulriser

MAMP is so touchy. Here's what worked for me:

MAMP 太敏感了。以下是对我有用的内容:

cd /Applications/MAMP

cd /Applications/MAMP

Move or rename: mv tmp tmp_OLD.

移动或重命名:mv tmp tmp_OLD

Recreate the folder and a subfolder: mkdir tmp; mkdir tmp/mysql

重新创建文件夹和子文件夹: mkdir tmp; mkdir tmp/mysql

Now start mysql from MAMP. I think it's possible the socket lock file (tmp/mysql/mysql.sock.lock) gets corrupted and needs to be regenerated.

现在从 MAMP 启动 mysql。我认为套接字锁定文件 ( tmp/mysql/mysql.sock.lock) 可能已损坏并需要重新生成。

回答by imbond

In some cases it may possible that the MySQL is already running on 3306 port. So, you can change the port number with 3307.

在某些情况下,MySQL 可能已经在 3306 端口上运行。因此,您可以使用 3307 更改端口号。

P.S: If you are bound to use 3306 in that case I think you can stop existing MySql server and let MAMP to do it for you.

PS:如果在这种情况下您必须使用 3306,我认为您可以停止现有的 MySql 服务器并让 MAMP 为您完成。