Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

4 Answers 4

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

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:

[client]
default-character-set=utf8
socket=/var/lib/mysql/mysql.sock
share|improve this answer
    
did you mean sudo nano /etc/mysql/my.cnf –  jschoen Nov 11 '10 at 18:42

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

I have the same problem except it is var/lib/mysql/mysql.sock(2) Looking in both these directories there are no mysql.sock files perhaps this is the problem Hope this helps Regards Gordon McIntosh

share|improve this answer

Your Answer

 
discard

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.