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

First thing in the morning, I got this mysql server error.

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

Apparently, /tmp/mysql.sock is missing. I know that’s the right path, but the file is not there.

I restarted the mysql server by press the “Start MySQL Server” button, but it’s not running. I ran mysqld, but it gave me more errors and failed to start.

I ended up making it work by providing a my.cnf file, which I hadn’t needed.

sudo cp /usr/local/mysql/support-files/my-large.cnf /etc/my.cnf

Modify the default settings if needed. Then press the “Start MySQL Server” button again. My apache server then worked fine.

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s