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?
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:
Then running
mysqld
followed by the regular MySQL start command fixed everything.Thanks to everyone who helped!
while restarting mysql run
and observe what's going on there. maybe you've run out of disk space on data / log partitions.