Thursday, July 10, 2008

Fixing MySQL Problem - Unable to connect via socket

A common problem I saw with MySQL, after a system update (10.4.4) or on later systems (Leopard on PPC computers) there are problems connecting via the MySQL Socket, it says the socket file not found.

Apparently is it because the socket file got moved during the update [http://www.macosxhints.com/article.php?story=20060111113313511]. To repair this problem, open the Terminal and enter the following commands:
$ sudo mkdir /var/mysql

$ sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
The first line is creating a folder called "mysql" inside the "var" folder at the root level, the second line is making a link called "mysql.sock" to the actual "mysql.sock" file (at the changed location) inside the invisible "tmp" folder.

Do this and you should be fine again.

You might want to look at:
  • http://en.wikipedia.org/wiki/Ln_(Unix)
  • http://en.wikipedia.org/wiki/Mkdir
  • http://en.wikipedia.org/wiki/Sudo
  • No comments: