2017年4月6日 星期四

mysql -h localhost 失敗

一直無法使用
mysql -h localhost -P 3306 -u root -pkerker
連線到我 local 的 mysql server,氣死我老百姓,錯誤訊息:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
結果最後發現是要用
mysql -h 127.0.0.1 -P 3306 -u root -pkerker
原來 127.0.0.1 跟 localhost 還是不一樣的 XD

reference
[1] http://stackoverflow.com/questions/9714899/php-mysql-difference-between-127-0-0-1-and-localhost
[2] https://dev.mysql.com/doc/refman/5.6/en/can-not-connect-to-server.html

沒有留言:

張貼留言