5

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.

3 Answers 3

4

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
1
  • A slightly more compact way to check if MySQL is running: ps -A | grep mysqld
    – ayan4m1
    Nov 11, 2010 at 17:53
1

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.

1
  • in some versions, you may find mysql errors in /var/log/syslog, too.
    – grossvogel
    Nov 13, 2010 at 0:55
0

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
1
  • did you mean sudo nano /etc/mysql/my.cnf Nov 11, 2010 at 18:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .