- MacBook Pro
- Visual Studio
Mac 에서 MySQL 연결 오류 본문
Mac 에서 MySQL 연결 오류사짜 참을인 2018.01.12 09:21
For some reason mysql on OS X gets the locations of the required socket file a bit wrong, but thankfully the solution is as simple as setting up a symbolic link.
You may have a socket (appearing as a zero length file) as /tmp/mysql.sock or /var/mysql/mysql.sock but 1 or more apps is looking in the other location for it.
Rather than move the socket and have to edit config files and remember to keep edited files local and away from servers where the paths are correct, simply create a symbolic link so your mac finds the required socket, even when it's looking in the wrong place!
If you have /tmp/mysql.sock but no /var/mysql/mysql.sock then...
sudo mkdir mysql
sudo chmod 755 mysql
sudo ln -s /tmp/mysql.sock mysql.sock
If you have /var/mysql/mysql.sock but no /tmp/mysql.sock then
ln -s /var/mysql/mysql.sock mysql.sock
You will need permissions to create the directory and link, so just prefix the commands above with sudo if necessary.
Hope this helps. It has sorted this exact issue for me on 3 macs so far.