I've just rebooted my Ubuntu server and MySQL just won't start for some reason! I'm using:

/etc/init.d/mysql start

I just get this:

 * Starting MySQL database server mysqld                         [fail]

Why might this be happening? Apache is running and my site works OK apart from the database connection. MySQL server is installed normally via synaptic.

I ran:

sh -x /etc/init.d/mysql start

Which listed this among the output:

+ echo -e 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in\n/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!\n

I followed the advice here for creating the .sock file but no luck.

(Let me know any more information you need me to provide.)

Update: I ran mysqld since the output above mentioned it, and got this error:

100516 17:37:57  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.

Any idea what it means, or what file it refers to?

  • 2
    What does /var/log/daemon.log say in regards to mysql? – andol May 16 '10 at 8:10
  • @andol: there's nothing in there about mysql at all. Also, /var/log/mysql.err and /var/log/mysql.log are empty. – DisgruntledGoat May 16 '10 at 8:19
  • my guess is that the socket doesn't have the correct permissions or that you are out of space. – Marco Ramos May 16 '10 at 9:55

Success! As mentioned in the question update, running mysqld gave some errors. I found the files and realized that the entire /var/lib/mysql directory had the wrong owner (root instead of mysql). This was due to the partition swap and file moving I did.

So I ran:

chown -R mysql /var/lib/mysql/

Then running mysqld followed by the regular MySQL start command fixed everything.

Thanks to everyone who helped!


while restarting mysql run

tail -f /var/log/syslog

and observe what's going on there. maybe you've run out of disk space on data / log partitions.

  • I had run out of disk space yesterday, but I swapped two partitions so there's plenty of disk space now. Could there be some issue related to that maybe? – DisgruntledGoat May 16 '10 at 10:54
  • Also, there's nothing in that syslog file from today, only yesterday morning, way before I did any of this. – DisgruntledGoat May 16 '10 at 10:56
  • 1
    Very strange there are no logs - what does df -h /var have to say ? – Iain May 16 '10 at 11:12
  • @DisgruntledGoat reboot for a good measure – pQd May 16 '10 at 12:19
  • @Iain: it says Use% is 2%. The partition that I swapped it with is 4% used. – DisgruntledGoat May 16 '10 at 16:26

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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