Home > MySQL, ubuntu > MySQL ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’

MySQL ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’

After some time whitout using my local MySql today I’ve tried to run it again and I’m getting errors trying to connect (with MysqlAdmin, phpMyAdmin and via shell):


$ sudo mysql status
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

So I tried this, after reading some posts:


$ cd /tmp

$ sudo ln -s /var/run/mysqld/mysqld.sock mysqld.sock

And then I did a restart of MySql, but still not working. Also tried this unsuccessfully:


$ sudo update-rc.d mysql defaults

$ service mysql start
start: Rejected send message, 1 matched rules; type="method_call", sender=":1.51" (uid=1000 pid=3393 comm="start) interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply=0 destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init"))
$ service mysql status
mysql respawn/post-start, (post-start) process 3411

Tired of reading a lot of posts, I decided to reinstall all of MySql stuff:

</pre>
$ sudo apt-get remove mysql-*

$ sudo apt-get autoremove

$ sudo apt-get install mysql-server-5.1 mysql-admin phpmyadmin

And now it works, an all of my databases are intact!

Advertisements
Categories: MySQL, ubuntu Tags:
  1. No comments yet.
  1. No trackbacks yet.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: