Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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,

like image 633
Matyas Avatar asked Nov 06 '14 10:11

Matyas


People also ask

Can not connect to MySQL server through socket?

Solution #2: Connect with 127.0. Another possible solution to the >can't connect to local mysql server through socket> error message is to try and connect to the MySQL using the 127.0. 0.1 ip address instead of localhost. When you use localhost to connect to MySQL, the operating system uses the socket connector.

Can not connect to local MySQL server through socket '/ tmp MySQL sock?

It means either the MySQL server is not installed/running, or the file mysql. sock doesn't exist in /var/lib/mysql/ . There are a couple of solutions for this error. Then try to connect again.


1 Answers

In some cases /Applications/MAMP/tmp/mysql/mysql.sock.lock may create the problem. remove .lock and it will work (OSX)

like image 66
Varshaan Avatar answered Sep 23 '22 13:09

Varshaan