我正在使用MAMP的phpMyAdmin进行操作,一切都很顺利,直到我在SQL选项卡中查询了一个ALTER TABLE
语句。操作时间太长,所以我决定刷新页面。从那时起,我再也无法访问phpMyAdmin,并且总是会看到以下消息:
#2002 - Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2)
我尝试了很多在网上找到的方法,包括 Stackoverflow、Server Fault 等,例如重新安装 MAMP,将符号链接指向 /tmp/mysql.sock
,修改 config.inc.php
等等,但都没有奏效。
当我从命令行运行 mysql
时,一切都很好:
$ /Applications/MAMP/Library/bin/mysql -u root -p
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.29 Source distribution
mysql> SHOW SCHEMAS;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0,65 sec)
mysqld
正常运行:
$ ps -e | grep mysql
7007 ?? 0:00.03 /bin/sh /Applications/MAMP/Library/bin/mysqld_safe --port=8889 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --lower_case_table_names=0 --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error=/Applications/MAMP/logs/mysql_error_log
7141 ?? 0:00.37 /Applications/MAMP/Library/bin/mysqld --basedir=/Applications/MAMP/Library --datadir=/Applications/MAMP/db/mysql --plugin-dir=/Applications/MAMP/Library/lib/plugin --lower-case-table-names=0 --log-error=/Applications/MAMP/logs/mysql_error_log.err --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --socket=/Applications/MAMP/tmp/mysql/mysql.sock --port=8889
并且套接字文件存在:
$ ls -la /Applications/MAMP/tmp/mysql/mysql.sock
srwxrwxrwx 1 user admin 0 21 avr 16:57 /Applications/MAMP/tmp/mysql/mysql.sock
有人已经遇到过这种问题了吗?