Tuesday, August 03, 2010

OSX Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

After installing MySQL from mysql-5.5.5-m3-osx10.6-x86_64.dmg I got:

Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

I did all I could to get MySQL to work. I reinstalled MySQL from different binaries, used MacPorts, changed permissions, edited configuration files and so on. Reinstalling OSX is not an option at the moment for me so I will need to start MySQL from now on using the below command:

sudo /usr/local/mysql/bin/mysqld_safe &

In the case you need to reinstall MySQL because the above does not work you need to run some commands in order to be able to reinstall.
$ sudo rm -fR /usr/local/mysql*
$ sudo rm -rf /Library/StartupItems/MySQLCOM
$ sudo rm -rf /Library/PreferencePanes/My*
$ rm -rf ~/Library/PreferencePanes/My*
$ sudo rm -rf /Library/Receipts/mysql*
$ sudo rm -rf /Library/Receipts/MySQL*
$ sudo rm -rf /var/db/receipts/com.mysql.*
$ sudo vi /etc/hostconfig
# remove or delete the below line if present
#MYSQLCOM=-YES-

Finally I recommend using version 5.1 instead of 5.5. It works more stable in OSX in my experience.

No comments:

Followers