mysqlmamp

MySQL server does not start with MAMP


Environment

Issue

I was using MySQL on MAMP but now having errors after restarted my mac.

First, I got this error.

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

And, the Stop-icon on MAMP is orange (I think it was usually green).

enter image description here

What I did so far:

  1. Checked if the mysql.sock file exists.
$ ls /Applications/MAMP/tmp/mysql/
  1. Created mysql.sock file.
$ touch /Applications/MAMP/tmp/mysql/mysql.sock
  1. Tried to start mysql again. (The Error message changed from (2) to (38).)
$ mysql -u root -p
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (38)
  1. Tried to start mysql server.
$ mysql.server start
-bash: mysql.server: command not found
  1. Checked if the path is set.
$ mysql --version
mysql  Ver 14.14 Distrib 5.7.34, for osx10.12 (x86_64) using  EditLine wrapper
  1. Used the full path
$ /Applications/MAMP/Library/bin/mysql -u root -p
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2)

Solution

  • This issue was resolved by removing (just moved to trash) and reinstalling MAMP.