I've got Ubuntu 10.04 LTS installed on a machine as a LAMP server. Every so often my MySQL connection dies, and I get this error message:

Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)

After this I have to reboot my server to get it working again.

It seems to happen without warning. What is the best way to debug this problem? I'm fairly new to command line Linux, so please be gentle.

Edit: Upon looking at the mysql log, here's what I found:

100813 18:56:16 [Note] Plugin 'FEDERATED' is disabled.
100813 18:56:16  InnoDB: Started; log sequence number 0 44233
100813 18:56:16 [ERROR] Column count of mysql.db is wrong. Expected 22, found 20. The table is probably corrupted
100813 18:56:16 [ERROR] mysql.user has no `Event_priv` column at position 29
100813 18:56:16 [ERROR] Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.
100813 18:56:16 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.1.41-3ubuntu12'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
100813 18:56:17 - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

seems like your mysql server crushes and removes the socket, take a look at the mysql server logs it should indicate what the problem.


Okay that shows that your user table is corrupt, try repairing it

use mysql
repair table user

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.