MAMP:Mysql 不会打开
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4145182/
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
MAMP : Mysql won't turn on
提问by theliberalsurfer
My mamp mysql server won't turn on. I tried executing /Applications/MAMP/bin/startMysql.sh but that gave me this error :
我的 mamp mysql 服务器无法打开。我尝试执行 /Applications/MAMP/bin/startMysql.sh 但这给了我这个错误:
101110 05:50:31 mysqld_safe Logging to '/Applications/MAMP/logs/mysql_error_log.err'.
101110 05:50:32 mysqld_safe Starting mysqld daemon with databases from /Applications/MAMP/db/mysql
101110 05:50:32 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended
101110 05:50:31 mysqld_safe 记录到“/Applications/MAMP/logs/mysql_error_log.err”。
101110 05:50:32 mysqld_safe 使用 /Applications/MAMP/db/mysql 中的数据库启动 mysqld 守护进程
101110 05:50:32 来自 pid 文件/Applications/MAMP/tmp/mysql/mysql.pid 的 mysqld_safe mysqld 结束
/Applications/MAMP/logs/mysql_error_log.err :
/Applications/MAMP/logs/mysql_error_log.err :
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/operating-system-error-codes.html
InnoDB: Could not open or create data files.
InnoDB: If you tried to add new data files, and it failed here,
InnoDB: you should now edit innodb_data_file_path in my.cnf back
InnoDB: to what it was, and remove the new ibdata files InnoDB created
InnoDB: in this failed attempt. InnoDB only wrote those files full of
InnoDB: zeros, but did not yet use them in any way. But be careful: do not
InnoDB: remove old data files which contain your precious data!
101110 5:53:08 [ERROR] Plugin 'InnoDB' init function returned error.
101110 5:53:08 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
101110 5:53:08 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use
101110 5:53:08 [ERROR] Do you already have another mysqld server running on port: 3306 ?
101110 5:53:08 [ERROR] Aborting
101110 5:53:08 [Warning] Forcing shutdown of 2 plugins
101110 5:53:08 [Note] /Applications/MAMP/Library/libexec/mysqld: Shutdown complete
101110 05:53:08 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended
InnoDB:http: //dev.mysql.com/doc/refman/5.1/en/operating-system-error-codes.html
InnoDB:无法打开或创建数据文件。
InnoDB:如果您尝试添加新数据文件,但在此处失败,
InnoDB:您现在应该编辑 my.cnf 中的 innodb_data_file_path
InnoDB:恢复原状,并删除 InnoDB 创建的新 ibdata 文件
InnoDB:在这次失败的尝试中。InnoDB 只写了那些充满
InnoDB:零,但尚未以任何方式使用它们。但要小心:不要
InnoDB:删除包含您宝贵数据的旧数据文件!
101110 5:53:08 [错误] 插件“InnoDB”初始化函数返回错误。
101110 5:53:08 [错误] 插件“InnoDB”注册为存储引擎失败。
101110 5:53:08 [错误] 无法启动服务器:在 TCP/IP 端口上绑定:地址已在使用中
101110 5:53:08 [错误] 您是否已经在端口 3306 上运行了另一个 mysqld 服务器?
101110 5:53:08 [错误] 中止
101110 5:53:08 [警告] 强制关闭 2 个插件
101110 5:53:08 [注意] /Applications/MAMP/Library/libexec/mysqld:关闭完成
101110 05:53:08 来自 pid 文件/Applications/MAMP/tmp/mysql/mysql.pid 的 mysqld_safe mysqld 结束
采纳答案by Thomas
Well I'm glad for you it fixed itself on its own ;)
好吧,我为你感到高兴,它可以自行修复;)
From the look of your error file, it looks like you already had an instance of MySQL running... Not sure if this works on a mac, but you could try :
从错误文件的外观来看,您似乎已经运行了一个 MySQL 实例……不确定这是否适用于 mac,但您可以尝试:
pidof mysqld
If this outputs something (one or several numbers), then MySQL is running. If the output is empty, then it is not.
如果这输出了一些东西(一个或几个数字),那么 MySQL 正在运行。如果输出为空,则不是。
回答by theliberalsurfer
twob.net has a pretty good fix for it. Go Into terminal and type in
twob.net 有一个很好的修复程序。进入终端并输入
killall -9 mysqld
Check it - http://twob.net/journal/fix-for-mamp-mysql/. Worked for me
检查它 - http://twob.net/journal/fix-for-mamp-mysql/。为我工作
回答by ryentzer
What I have found is that at times more than one occurrence of mysql is running. What I do when MySQL will not start is I first quit MAMP, then I go into the Applications/utlities and open the Activity Monitor. From there I search for "my" which should bring up any mysql's that may be running. I then either quit or force quit mysql. At that point I'm able to open MAMP with a working MySQL server.
我发现有时运行不止一次的 mysql。当 MySQL 无法启动时,我首先退出 MAMP,然后进入应用程序/实用程序并打开活动监视器。从那里我搜索“我的”,它应该会显示任何可能正在运行的 mysql。然后我要么退出,要么强制退出 mysql。在这一点上,我可以用一个工作的 MySQL 服务器打开 MAMP。
Hope that helps.
希望有帮助。
回答by D. Woods
With a new/clean install of MAMP 4.1.1, I had the same problem.
通过全新/全新安装的 MAMP 4.1.1,我遇到了同样的问题。
When running:
/Applications/MAMP/bin/startMysql.sh
运行时:
/Applications/MAMP/bin/startMysql.sh
MySql reported:
MySql 报告:
mysqld_safe error: log-error set to '/Applications/MAMP/logs/mysql_error_log.err', however file don't exists. Create writable for user 'mysql'..
mysqld_safe error: log-error set to '/Applications/MAMP/logs/mysql_error_log.err', however file don't exists. Create writable for user 'mysql'..
So, I ran touch /Applications/MAMP/logs/mysql_error_log.errand tried again with startMysql.sh. It worked (but it wasn't quite "by itself")!
所以,我跑了touch /Applications/MAMP/logs/mysql_error_log.err又试了一次startMysql.sh。它起作用了(但它并不是“靠它自己”)!
回答by Invincible
This command worked for me.
这个命令对我有用。
ps aux | grep mysql
lsof -i
killall -9 mysqld
if needed
如果需要的话
sudo killall -9 mysqld
Ref: http://www.witheringtree.com/2010/05/how-to-resolve-mysql-not-starting-in-mamp/
参考:http: //www.witheringtree.com/2010/05/how-to-resolve-mysql-not-starting-in-mamp/
回答by Mike
Jmeyer, on occasion MAMP will do strange things like refuse to restart. When this happens, go to the MAMP application and click "preferences" and then just click "Ok."
Jmeyer,有时 MAMP 会做一些奇怪的事情,比如拒绝重启。发生这种情况时,请转到 MAMP 应用程序并单击“首选项”,然后单击“确定”。
For some reason this forces a restart of the MAMP server.
出于某种原因,这会强制重新启动 MAMP 服务器。
Not sure if that's what you were looking for, but a helpful tip nonetheless.
不确定这是否是您要查找的内容,但仍然是一个有用的提示。
回答by Jared
This is what did it for me, in terminal:
这就是在终端为我所做的:
sudo chown -R mysql:mysql /usr/local/mysql
须藤 chown -R mysql:mysql /usr/local/mysql
回答by Theo C
There are multiple ways to fix this - usually one works.
有多种方法可以解决此问题 - 通常一种有效。
To start off, try quitting MAMP and then:
首先,尝试退出 MAMP,然后:
sudo killall -9 mysqld
If that fails, try going to Preferences > Ports and changing to MAMP default. Click ‘OK'. MySQL should then start. If your website doesn't show up at localhost, try changing the ports back.
如果失败,请尝试转到 Preferences > Ports 并更改为 MAMP 默认值。单击“确定”。MySQL应该然后启动。如果您的网站没有出现在localhost,请尝试将端口改回。
You can also stop MAMP, go to System Preferences > MySQL and turn off MySQL and then restart MAMP.
您也可以停止 MAMP,转到系统偏好设置 > MySQL 并关闭 MySQL,然后重新启动 MAMP。
Hope this helps!
希望这可以帮助!
回答by Umar Adil
other way that might fix the same problem :
可能解决相同问题的其他方法:
-go in the folder MAMP/db/mysql/ – delete all files that IS NOT A FOLDER (files like ‘mysql-bin.XXXXXX' / ‘mysql-bin.index'/ ‘ibdata1' / ‘ib_logfileX'
-进入文件夹 MAMP/db/mysql/ – 删除所有不是文件夹的文件(文件如 'mysql-bin.XXXXXX' / 'mysql-bin.index'/ 'ibdata1' / 'ib_logfileX'
don't worry, this doesn't erase any of your database, but make sure you don't delete the folders. That's where the data of your databases are stored.
别担心,这不会删除您的任何数据库,但请确保您不要删除文件夹。那就是存储数据库数据的地方。
回答by miko
Another gotcha:
Check who is the owner of /Applications/MAMP/logs/mysql_error_log.err
另一个问题:
检查谁是/Applications/MAMP/logs/mysql_error_log.err
On my machine, it is owned by admin: admin./Applications/MAMP/bin/startMysql.shwill fail to start, even if run with sudo.
在我的机器上,它归admin: admin. /Applications/MAMP/bin/startMysql.sh即使使用 sudo 运行,也将无法启动。
But this will work:
但这会起作用:
sudo su admin
/Applications/MAMP/bin/startMysql.sh

