up vote 1 down vote favorite
share [g+] share [fb]

I'm getting this error when trying to log into MySQL from the command line:

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

I think this means that MySQL hasn't been started yet. So I try to start it:

sudo /etc/init.d/mysql start

and I get this message:

* Starting MySQL database server mysqld [fail]

Where do I look/what do I do to get MySQL to start? I am running Ubuntu 8.04 and installed MySQL through apt-get. I have been able to get it started and used it a couple times so I don't know why it just stopped working.

Update: When running sudo /etc/init.d/mysql status I get the message:

* MySQL is stopped.

Update #2: My log files (/var/log/mysql.log & /var/log/mysql.err) are empty (if these are the right ones)

link|improve this question

65% accept rate
what happens when you sudo /etc/init.d/mysql status – emgee Oct 17 '09 at 22:27
feedback

3 Answers

Take a look at your log files. On Debian at least, you get mysql* logs in /var/log.

link|improve this answer
mysql.err and mysql.log are both empty – Andrew Oct 17 '09 at 23:36
feedback

WARNING: This is dangerous, your mysql will NOT be safe and anyone will be able to connect, edit, etc your tables, do not leave your server running with this command.

Try starting it in safe mode: /usr/local/mysql/bin/safe_mysqld --user=mysql --skip-grant-tables

If this works then there might be problems with your information_schema or your mysql table(s). If it doesn't work than something is wrong with your install.

link|improve this answer
feedback

Check your log files as in the other answers. Also, check that you have enough (or any disk-space). MySQL can behave in this way on an empty partition.

df -h

If it's not that, check out MySQL's docs on debugging a server. Their myisamchk (if you're using MyISAM) is particularly useful.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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