Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been trying to install MySQL on Ubuntu 10.10 and just can't get it to work. I installed it by running sudo apt-get install mysql-server and once that was done, when I try mysql I get the message:

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

I tried mysql start and get the same thing. I am sure I am doing something wrong, any pointers would be great.

share|improve this question
up vote 4 down vote accepted

To start the mysql demon (or service) you should do:

sudo start mysql

the old way should still work for now:

sudo /etc/init.d/mysql start

But it's quite strange that mysql didn't start while installing. IIRC, it should be started at the end of the installation and autstarted by default with the system. You can check if the server is running using:

ps -A u | grep sql
share|improve this answer
A slightly more compact way to check if MySQL is running: ps -A | grep mysqld – ayan4m1 Nov 11 '10 at 17:53

You can check for mysql startup errors by looking at the log files. In a terminal, type:

tail /var/log/mysql.log
tail /var/log/mysql.err

That should let you see the specific errors that are keeping it from running.

share|improve this answer
in some versions, you may find mysql errors in /var/log/syslog, too. – grossvogel Nov 13 '10 at 0:55

To installations of MySQL can specify where we will have the socket for local connections

you have to modify this file (/etc/mysql/my.cnf)

sudo nano /etc/mysql/my.cnf

and add the parameter socket in the section client:

share|improve this answer
did you mean sudo nano /etc/mysql/my.cnf – Jacob Schoen Nov 11 '10 at 18:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.