MAMP 的 PHPMyAdmin 给我 #2002 mysql 错误

发布于 2024-12-02 22:38:37 字数 811 浏览 2 评论 0原文

因此,只有当我转到本地 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 文件中,您将值“localhost”替换为“127.0.0.1”,但这并没有改变情况。

然后我去 MYSQL 论坛查找,建议检查 my.cnf 文件以检查某些值。但我到处都找不到它。 MAMP 中是否有另一个具有相同功能的文件?

So only when I go to my local PhpMyAdmin window, I get the #2002 message.
I searched the net and I found a terminal command to check if Mysql would be running in the first place and it does.

Running /Applications/MAMP/Library/bin/mysql -u root -p

gives me

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.

That doesn't look bad I think so the error must not have much to do with that.

I read that there's the config.inc.php file where you replace the value 'localhost' with '127.0.0.1' but that didn't change the situation.

Then I went looking in MYSQL forums it is suggested to check the my.cnf file to check for certain values. but I can't find it anywhere. Is there another file that has the same function in MAMP?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

想念有你 2024-12-09 22:38:37

由于得票最高的答案托管在 Posterous 上,而 Posterous 已不复存在,因此这有点孤儿。内容为 已在 Archive.org 存档,但以防万一 也消失,链接的答案是:

今天,我尝试使用 SQL Packager 在 OS X Lion 上安装 Mysql。我遇到了非常常见的问题

MySQL 论坛 :: 安装 :: 错误 2002 (HY000): 无法通过套接字 '/tmp/mysql.sock' 连接到本地 MySQL 服务器 (2)

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

ps -e|grep mysqld

sudo mysqld_safe

感谢 David Bocage 的提示。

Since the top-voted answer was hosted on Posterous, which no longer exists, this is a bit of an orphan. The content is archived at Archive.org but just in case that goes away, too, the linked answer was:

Today, I tried to install Mysql on OS X Lion using SQL Packager. I faced a very common issue:

MySQL Forums :: Install :: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Turns out you can regenerate this file in the terminal with this:

ps -e|grep mysqld

sudo mysqld_safe

Thanks David Bocage for the tip.

雄赳赳气昂昂 2024-12-09 22:38:37

好吧,

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

我还注意到 MAMP 中的实际端口设置(8888)和我不记得的某个 php 文件(其中是 3306)之间存在端口号不匹配,该文件设置为再次匹配。但不能确定这就是它起作用的原因。

Alright,

I finally got my PHPmyadmin page loaded again without getting the #2002 error. What I did is I kept reviewing the settings for the mysql socket file until at a certain point my phpmyadmin did show up the way it should. So I'm still not really sure why it happened.

I also noticed there was a portnumber mismatch between the actual port setting in MAMP (8888) and a certain php file I cant remember (where it was 3306) which set to match again. Can't be certain that this is what made it work though.

情域 2024-12-09 22:38:37

我也遇到了同样的问题。简单修复:

转到 /Application/MAMP/bin/phpMyAdmin/ 并打开

第 71 行上的 config.inc.php,您会看到 $cfg ['Servers'][$i]['port']

由于某种原因,我的计算机上的默认端口已切换,因此我将其设置为 8889。保存后 phpmyadmin 即可恢复并正常工作!

呜呜

I had the same problem. Easy fix:

Go to /Application/MAMP/bin/phpMyAdmin/ and open up config.inc.php

on line 71 you see $cfg['Servers'][$i]['port']

For some reason the default ports got switched on my machine, so I set it to 8889. Save and phpmyadmin is back up and working!

Wooo

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文