Reputation: 133
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,
Upvotes: 13
Views: 27166
Reputation: 610
1) mysql.server stop
2) /Applications/MAMP/bin/startMysql.sh &&
now on MAMP go to
Tools => Upgrade MySQL databases
Upvotes: 0
Reputation: 593
In some cases /Applications/MAMP/tmp/mysql/mysql.sock.lock may create the problem. remove .lock and it will work (OSX)
Upvotes: 9
Reputation: 1
In case this helps anyone, I got past this roadblock by:
sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
Upvotes: 0
Reputation: 151
simply remove two files ib_logfile0 and ib_logfile1 from /Applications/MAMP/db/mysql56
Upvotes: 15
Reputation: 369
I had the same problem after upgrading MySQL on MAMP from 5.5 to 5.6 version. After long research I founded this decision https://drupal.stackexchange.com/questions/32402/drush-and-mysql-database-with-mamp-connection-problem
In my case there was no socket file at that location /Applications/MAMP/tmp/mysql/mysql.sock
.
The easy solution is to create a symlink:
cd /tmp
ln -s /Applications/MAMP/tmp/mysql/mysql.sock ./mysql.sock
The effect of which is to route all calls for /tmp/mysql.sock to the appropriate MAMP specific path.
Upvotes: 19
Reputation: 405
Also check to make sure MySql is running. You can get this error if you try to use MySql from the command line when MAMP/MySql is not running.
Upvotes: 2
Reputation: 1117
I had the same problem. I solved it following these steps:
sudo mysql_upgrade
in a terminal window, and pressed enterAfter the update process I was able to connect with my MySQL.
Upvotes: 5
Reputation: 1583
Rename .sock
file of mysql and restart your MySQL server.
/Applications/MAMP/tmp/mysql/mysql.sock
to /Applications/MAMP/tmp/mysql/mysql_old.sock
Upvotes: 2