简体   繁体   English

在MAMP上运行mysql时出现问题

[英]Problems running mysql on MAMP

I am trying to get the MySQL server on MAMP to run, but to no avail. 我正在尝试使MAMP上的MySQL服务器运行,但无济于事。

It was working fine, but I stopped using MAMP when I started using Ruby on Rails. 一切正常,但是当我开始使用Ruby on Rails时,我停止使用MAMP。 Now I want to work on some older PHP projects that live in my MAMP install and I can't fire them up. 现在,我想处理MAMP安装中存在的一些较旧的PHP项目,但无法启动它们。 Most frustrating. 最令人沮丧。

I suspect it is related to the MySQL gem installed with RoR, but I am unsure as to how I can check or how I would fix the conflict. 我怀疑它与随RoR一起安装的MySQL gem有关,但我不确定如何检查或如何解决冲突。

My question, essentially, is "how can I start my mySql server?" 本质上,我的问题是“如何启动mySql服务器?”

Os: 10.7.4 MAMP V: 1.8.4 操作系统:10.7.4 MAMP V:1.8.4

I have check the logs: 我已经检查了日志:

Output of tail mysql_error_log.err -n 100 : tail mysql_error_log.err -n 100输出:

==> mysql_error_log.err <==
120715 12:11:41 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use
120715 12:11:41 [ERROR] Do you already have another mysqld server running on port: 3306 ?
120715 12:11:41 [ERROR] Aborting

120715 12:11:41  InnoDB: Starting shutdown...
120715 12:11:42  InnoDB: Shutdown completed; log sequence number 0 44233
120715 12:11:42 [Warning] Forcing shutdown of 2 plugins
120715 12:11:42 [Note] /Applications/MAMP/Library/libexec/mysqld: Shutdown complete

120715 12:11:42 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended

Update 更新

I have tried to edit the my.cnf of the running instances, as suggested. 我已尝试按照建议编辑正在运行的实例的my.cnf。 I dod this my running locate my.cnf to find the files. 我在运行中locate my.cnf来查找文件。

that returned two results, one which was in MAMP PRO (which I am not using) and another (based in Macports). 返回两个结果,一个结果在MAMP PRO中(我未使用),另一个结果在Macports中。 I chose to edit lines 15 and 34 of the Macports file. 我选择编辑Macports文件的第15和34行。 . I then restarted the machine. 然后,我重新启动了计算机。

It appears I am getting the same error: 看来我遇到了同样的错误:

==> mysql_error_log.err <==
120715 13:37:26 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use
120715 13:37:26 [ERROR] Do you already have another mysqld server running on port: 3306 ?
120715 13:37:26 [ERROR] Aborting

120715 13:37:26  InnoDB: Starting shutdown...
120715 13:37:27  InnoDB: Shutdown completed; log sequence number 0 44233
120715 13:37:27 [Warning] Forcing shutdown of 2 plugins
120715 13:37:27 [Note] /Applications/MAMP/Library/libexec/mysqld: Shutdown complete

120715 13:37:27 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended

120715 12:11:41 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use 120715 12:11:41 [错误]无法启动服务器:在TCP / IP端口上绑定:地址已在使用中

120715 12:11:41 [ERROR] Do you already have another mysqld server running on port: 3306 ? 120715 12:11:41 [错误]您是否已经在端口3306上运行了另一个mysqld服务器?

You already have MySQL or some other program using the port 3306. You can either terminate the existing program or use a different port. 您已经具有使用端口3306的MySQL或其他程序。您可以终止现有程序或使用其他端口。

The port can be changed in the MySQL configuration file my.cnf . 可以在MySQL配置文件my.cnf更改端口。

Did you ever find a solution for this? 您是否找到了解决方案? This isn't an answer so much as a temporary hack to get the old PHP project working. 这并不是一个解决办法,而只是一个临时的技巧,可以使旧的PHP项目正常工作。 As Joni said, terminating MySQL will do the trick. 正如乔尼所说,终止MySQL可以解决问题。 Here's how I did it: The Macports/Homebrew version of MySQL should launch on boot, so when MAMP is launched only Apache starts. 这是我的操作方法:MySQL的Macports / Homebrew版本应在启动时启动,因此当启动MAMP时,仅Apache启动。 In Activity Monitor, search for 'mysql' — 1 or 2 instances of 'mysqld' should appear. 在活动监视器中,搜索“ mysql”-应显示“ mysqld”的1或2个实例。 Quit these and immediately click 'Start Servers' in MAMP (FWIW, I am using the default Apache and MySQL ports (80 & 3306) in MAMP). 退出,然后立即单击MAMP中的“启动服务器”(FWIW,我正在使用MAMP中的默认Apache和MySQL端口(80和3306))。 It took a few tries, but eventually I beat the other daemon, which tries to restart. 尝试了几次,但最终我击败了另一个重新启动的守护程序。 A temporary and ugly solution, but it got me into an old project when I was short on time. 这是一个临时且丑陋的解决方案,但是当我时间不够时,它使我进入了一个旧项目。 I'm still looking for a permanent solution, one that doesn't involve completely scrapping everything and starting over. 我仍在寻找一种永久的解决方案,该解决方案不涉及完全废弃一切并重新开始。

Edit: A better way to kill mysqld using Terminal: killall mysqld 编辑:使用终端杀死mysqld的更好方法: killall mysqld

I'm on Mac and I installed MySql separate of MAMP, at some point. 我在Mac上,并且在某些时候单独安装了MySql和MAMP。 This version of MySql was blocking MAMP's MySql server. 此版本的MySql阻止了MAMP的MySql服务器。

Open up System Preferences and if you see a MySQL icon on the bottom row, open it up. 打开“系统偏好设置”,如果在底行看到一个MySQL图标,则将其打开。 Here it told me that I had a MySQL server instance running. 在这里,它告诉我我正在运行一个MySQL服务器实例。 Stop the server and uncheck "Automatically Start MySQL Server on Startup" 停止服务器并取消选中“启动时自动启动MySQL服务器”

Hope this helps someone! 希望这对某人有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM