我正在使用MAMP PHPMyAdmin,一切都运行良好,直到我从sql选项卡查询ALTER TABLE语句.操作太久了,所以我决定刷新我的页面.从这个时候起,我无法到达PHPMyAdmin了,我总是有这个消息:
#2002 - Can't connect to local MysqL server through socket '/Applications/MAMP/tmp/MysqL/MysqL.sock' (2)
我已经尝试了许多在网络上发现的东西,包括在Stackoverflow,服务器故障,…像重新安装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
并且socket文件存在:
$ls -la /Applications/MAMP/tmp/MysqL/MysqL.sock srwxrwxrwx 1 user admin 0 21 avr 16:57 /Applications/MAMP/tmp/MysqL/MysqL.sock
有人曾经遇到过这样的问题?
我看到完全一样MAMP MysqL运行,这个PHPMyAdmin的垃圾邮件
MysqL说:
#2002 - Can't connect to local MysqL server through socket '/tmp/MysqL.sock' (2)
服务器未响应(或本地服务器的套接字未正确配置).
我确实使用了:sudo ln -s /Applications/MAMP/tmp/MysqL/MysqL.sock /tmp/MysqL.sock
允许本地PHP CLI访问MAMP MysqL
我在这里找到PHPMyAdmin的配置文件:
/Applications/MAMP/bin/PHPMyAdmin/config.inc.PHP
$cfg['Servers'][$i]['socket'] = '/Applications/MAMP/tmp/MysqL/MysqL.sock';
现在它的作品:)