Environment
- Mac OS Big Sur Ver 11.6
- MAMP Ver 6.5
- PHP Ver 7.4.21
- MySQL Ver 14.14 Distribute 5.7.34
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).
What I did so far:
- Checked if the mysql.sock file exists.
$ ls /Applications/MAMP/tmp/mysql/
- Created mysql.sock file.
$ touch /Applications/MAMP/tmp/mysql/mysql.sock
- 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)
- Tried to start mysql server.
$ mysql.server start
-bash: mysql.server: command not found
- Checked if the path is set.
$ mysql --version
mysql Ver 14.14 Distrib 5.7.34, for osx10.12 (x86_64) using EditLine wrapper
- 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)