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.


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
  • 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.

  • 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:

  • did you mean sudo nano /etc/mysql/my.cnf Nov 11 '10 at 18:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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