MAMP的PHPMyAdmin给了我#2002 mysql错误

时间:2011-09-03 12:27:13

标签: mysql phpmyadmin

因此,只有当我访问我当地的PhpMyAdmin窗口时,才会收到#2002消息。 我搜索了网络,我发现了一个终端命令来检查Mysql是否会在第一时间运行而且确实在运行。

正在运行/Applications/MAMP/Library/bin/mysql -u root -p

给了我

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.5.9 Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

这看起来并不坏我认为错误与此无关。

我读到有config.inc.php文件,你用“127.0.0.1”替换值'localhost',但这并没有改变这种情况。

然后我去了MYSQL论坛,建议检查my.cnf文件以检查某些值。但我无法在任何地方找到它。是否有另一个文件在MAMP中具有相同的功能?

3 个答案:

答案 0 :(得分:4)

由于最高投票的答案是在Posterous(不再存在)上进行的,因此这是一个孤儿。 Archive.org上的内容为archived,但如果 也消失了,链接的答案是:

  

今天,我尝试使用SQL Packager在OS X Lion上安装Mysql。我遇到了very common issue

     

MySQL Forums :: Install :: ERROR 2002(HY000):无法通过socket'/tmp/mysql.sock'连接到本地MySQL服务器(2)

     

事实证明,您可以使用以下方法在终端中重新生成此文件:

     

ps -e|grep mysqld

     

sudo mysqld_safe

     

感谢David Bocage提示。

答案 1 :(得分:0)

好的,

我终于在没有收到#2002错误的情况下再次加载了我的PHPmyadmin页面。我做的是我一直在检查mysql套接字文件的设置,直到某个时候我的phpmyadmin确实显示了应该的方式。所以我仍然不确定为什么会这样。

我还注意到MAMP(8888)中的实际端口设置与我不记得的某个php文件(其中它是3306)之间的端口号不匹配,它们再次匹配。不能肯定这是使它工作的原因。

答案 2 :(得分:0)

我遇到了同样的问题。轻松修复:

转到/ Application / MAMP / bin / phpMyAdmin /并打开config.inc.php

line 71 {p>上看到$cfg['Servers'][$i]['port']

由于某种原因,默认端口已在我的机器上打开,因此我将其设置为8889。保存和phpmyadmin备份并正常工作!

的Wooo