Search code examples
macosmampmysql.sock

Yosemite - MAMP - Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2)


I have problem when I try to connect to MySQL MAMP :

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

I'm doing research but I have not found a solution to my problem, I try to link mysql.sock like this :

sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock

But, the file /tmp/mysql.sock doesn't exist.

Do you have any ideas ? The problem is blocking me for 2 days, I searched for this time but nothing good for me.

Thanks in advance,


Solution

  • I had the same problem. I solved it following these steps:

    1. I stopped and restarted MySQL via System Preferences -> MySQL (see also https://stackoverflow.com/a/26523977/204807)
    2. I entered sudo mysql_upgrade in a terminal window, and pressed enter

    After the update process I was able to connect with my MySQL.