Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've just installed MySql to support a mediawiki install on 12.04 64bit. Everything appears to be working ok, except that at boot-up, mysql server fails to start. This results in an error appearing on the webpage:

Can't connect to local MySQL server through socket /var/run/mysqld/mysqld.sock

When I discover this, and run

sudo service mysql start

It all works ok after that until the next reboot.

I can't figure out what is going on.

There appear to be several similar issues being reported, however most of these appear to be outright failure to start - i.e. manual start or on boot-up fails. I haven't seen anything relating to a "transient" error like this.

For the record, I've got a fairly standard install - I didn't fiddle with settings - just the bind address in /etc/mysql/my.cnf I thought maybe something to do with drive mounting, but datadir is on /var which is on the main partition.

any clues? Suggestions even for a workaround?

Only workaround I'm toying with is to set a cronjob at intervals of every half hour or so.

share|improve this question
What erros do you see on your mysql.log, like in /var/log/mysql... – LnxSlck Aug 15 '12 at 14:39
Sorry - I wasn't particularly helpful with my information... I did check /var/log/mysql.log and mysql.err - both empty. I also know that the service attempts to start because in dmesg, it shows messages saying post-start process terminating with status 1. I will need to get the actual messages later - I don't have access to them right now. – user38845 Aug 16 '12 at 0:37
Can you post here the output of the logs of mysql? – LnxSlck Aug 16 '12 at 0:39
Are there logs other than in /var/log? These were empty. – user38845 Aug 16 '12 at 0:41
Don't you have something like /var/log/mysql.* ? – LnxSlck Aug 16 '12 at 0:42
up vote 1 down vote accepted

I think I know what the problem was.... my dodgy router...

Our modem/router as a bad FW build on it (which I'm working on separately) which requires rebooting several times a day. This meant that often at bootup in the morning, the router would be "down", and the computer wouldn't even be able to get an IP address.

That IP address is a fixed address assigned by the router, and is set as the "bind address" in mysql configuration file ("my.cnf")

I haven't tested my theory properly, but I have noticed that sometimes it works at bootup and sometimes not. And I definitely know that it fails to start if the bind address is wrong - exhibiting the same sorts of failure messages in dmesg.

Thanks all for responding!

share|improve this answer
If you bind mysql address in my.cnf (or for any services/daemons your machine acts as a server), you should use a fixed IP on it and leave the router out of this matter. This way even if your router "feels lazy or gets mad", your server will have the right IP. – laurent Aug 23 '12 at 21:51

The MySQL service is probably not enabled at boot.

Try sudo update-rc.d mysql defaults and reboot.

share|improve this answer
Hi Marc - see my comments from above - it appears to be attempting to start, looking at dmesg, but reports "post-start process terminating with status 1" (plus a couple of other messages). – user38845 Aug 17 '12 at 1:45

Your Answer


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.