Technology, Uncategorized 0 comments on MySQL: Startup Error 2002 (HY000)

MySQL: Startup Error 2002 (HY000)

I installed MySQL 5.0 on my MacBook Pro and got the following error when I tried starting the server after a computer restart:

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)

It turns out that others were having this problem, and I wanted to go ahead and post the solution that I found to work the best:

Type the following commands into a Terminal window:

$ cd /usr/local/mysql
$ sudo ./scripts/mysql_install_db –rpm
$ sudo chown -R mysql data

Note that the line /usr/local/mysql is looking for the symlink at which your MySQL installation points. I pointed mine to /Library/MySQL and changed the line appropriately for my setup. After this, make sure you set the root password to access MySQL, and you should be all set.

*Note* I haven’t investigated this all the way through yet, but I now have to start using

myqld_safe –skip-grant &

as my daemon starting command. I will research this to understand what’s going on, and update this entry.