MAMP:Mysql 无法打开
我的 mamp mysql 服务器无法打开。我尝试执行 /Applications/MAMP/bin/startMysql.sh 但这给了我这个错误:
101110 05:50:31 mysqld_safe 记录到 '/Applications/MAMP/logs/mysql_error_log.err'。
101110 05:50:32 mysqld_safe 使用数据库启动 mysqld 守护进程 /Applications/MAMP/db/mysql
101110 05:50:32 mysqld_safe mysqld 来自 pid 文件 /Applications/MAMP/tmp/mysql/mysql.pid 结束
/Applications/MAMP/logs/mysql_error_log.err :
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 [错误] 你已经有另一个 mysqld 服务器了吗 在端口上运行:3306?
101110 5:53:08 [错误] 正在中止
101110 5:53:08 [警告] 强制关闭 2 个插件
101110 5:53:08 [注意] /Applications/MAMP/Library/libexec/mysqld: 关机完成
101110 05:53:08 mysqld_safe mysqld 来自 pid 文件 /Applications/MAMP/tmp/mysql/mysql.pid 结束
My mamp mysql server won't turn on. I tried executing /Applications/MAMP/bin/startMysql.sh but that gave me this error :
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/mysql101110 05:50:32 mysqld_safe mysqld from pid file
/Applications/MAMP/tmp/mysql/mysql.pid ended
/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
notInnoDB: 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 use101110 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 complete101110 05:53:08 mysqld_safe mysqld from pid file
/Applications/MAMP/tmp/mysql/mysql.pid ended
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
Twob.net 对此有一个很好的解决方案。
进入终端并输入
Check it - http://twob.net/journal/fix -for-mamp-mysql/。为我工作
twob.net has a pretty good fix for it.
Go Into terminal and type in
Check it - http://twob.net/journal/fix-for-mamp-mysql/. Worked for me
我发现有时不止一个 mysql 正在运行。当 MySQL 无法启动时,我首先退出 MAMP,然后进入应用程序/实用程序并打开活动监视器。从那里我搜索“my”,它应该会显示任何可能正在运行的 mysql。然后我要么退出,要么强制退出mysql。那时我就可以使用正在运行的 MySQL 服务器打开 MAMP。
希望有帮助。
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.
Hope that helps.
这个命令对我有用。
如果需要
参考:http:// www.witheringtree.com/2010/05/how-to-resolve-mysql-not-starting-in-mamp/
This command worked for me.
if needed
Ref: http://www.witheringtree.com/2010/05/how-to-resolve-mysql-not-starting-in-mamp/
全新/全新安装 MAMP 4.1.1 时,我遇到了同样的问题。
运行时:
/Applications/MAMP/bin/startMysql.sh
MySql 报告:
mysqld_safe 错误:日志错误设置为“/Applications/MAMP/logs/mysql_error_log.err”,但文件不存在。为用户“mysql”创建可写的。
。因此,我运行了
touch /Applications/MAMP/logs/mysql_error_log.err
并使用startMysql.sh
再次尝试。它起作用了(但它并不是完全“单独”)!With a new/clean install of MAMP 4.1.1, I had the same problem.
When running:
/Applications/MAMP/bin/startMysql.sh
MySql reported:
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.err
and tried again withstartMysql.sh
. It worked (but it wasn't quite "by itself")!好吧,我很高兴你它自己修复了自己;)
从你的错误文件的外观来看,看起来你已经有一个正在运行的 MySQL 实例...不确定这是否适用于 Mac,但你可以尝试:
如果输出一些内容(一个或几个数字),则 MySQL 正在运行。如果输出为空,则不是。
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 :
If this outputs something (one or several numbers), then MySQL is running. If the output is empty, then it is not.
其他可能解决相同问题的方法:
-进入文件夹 MAMP/db/mysql/ – 删除所有不是文件夹的文件(例如“mysql-bin.XXXXXX”/“mysql-bin.index”/“ibdata1”等文件) ' / 'ib_logfileX'
不用担心,这不会删除任何数据库,但请确保不要删除存储数据库数据的文件夹。
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’
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.
发生这种情况还有另一个原因,我没有看到有人提到它,所以我将在这个答案中解释它。
当您重新启动计算机时,有时会强制关闭应用程序,并且 MAMP 无法正确关闭 MySQL,这会使套接字文件保持完整,而不是 MySQL 在关闭过程中将其彻底删除。据我了解(需要来源),如果MySQL之前被强制关闭,它会进行套接字文件验证,但它不再这样做了。您需要执行以下操作:
killall -9 mysqld
确保没有 MySQL 实例仍在运行,然后按 Enter 执行命令。它将关闭所有剩余的正在运行的 mysql 实例。现在一切都应该启动并运行良好。如果没有或者找不到 mysql.sock 文件,您的问题可能是其他答案中提到的另一个问题。
There's another reason why this could be happening and I don't see anyone mentioning it, so I'll explain it in this answer.
When you reboot your computer, sometimes you force-close the apps and MAMP is not able to shutdown MySQL properly which leaves the socket file intact instead of MySQL removing it cleanly as part of its shutdown process. From what I understand (sources needed), MySQL used to make a socket file verification if it was forced to shutdown before, but it's not doing it anymore. Here's what you need to do:
killall -9 mysqld
in terminal, then press enter to execute the command. It will shut down all the leftover mysql instances running.Everything should be booting up and running fine now. If not or if you can't find the mysql.sock file, your issue could be another one mentioned in the other answers.
Jmeyer,有时 MAMP 会做一些奇怪的事情,比如拒绝重新启动。发生这种情况时,请转到 MAMP 应用程序并单击“首选项”,然后单击“确定”。
由于某种原因,这会强制重新启动 MAMP 服务器。
不确定这是否是您想要的,但仍然是一个有用的提示。
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."
For some reason this forces a restart of the MAMP server.
Not sure if that's what you were looking for, but a helpful tip nonetheless.
这就是我在终端中所做的:
sudo chown -R mysql:mysql /usr/local/mysql
This is what did it for me, in terminal:
sudo chown -R mysql:mysql /usr/local/mysql
有多种方法可以解决这个问题——通常只有一种方法有效。
首先,尝试退出 MAMP,然后:
如果失败,请尝试转到“首选项”>“MAMP”。端口并更改为 MAMP 默认值。单击“确定”。然后 MySQL 应该启动。如果您的网站未显示在
localhost
上,请尝试更改回端口。您还可以停止 MAMP,转到系统偏好设置 > MySQL 并关闭 MySQL,然后重新启动 MAMP。
希望这有帮助!
There are multiple ways to fix this - usually one works.
To start off, try quitting MAMP and then:
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.You can also stop MAMP, go to System Preferences > MySQL and turn off MySQL and then restart MAMP.
Hope this helps!
另一个问题:
检查谁是
/Applications/MAMP/logs/mysql_error_log.err
的所有者在我的机器上,它的所有者是
admin: admin
。即使使用 sudo 运行,
/Applications/MAMP/bin/startMysql.sh
将无法启动。但这会起作用:
Another gotcha:
Check who is the owner of
/Applications/MAMP/logs/mysql_error_log.err
On my machine, it is owned by
admin: admin
./Applications/MAMP/bin/startMysql.sh
will fail to start, even if run with sudo.But this will work: