Troubleshooting MySQL startup problems

Posted in February 2012 by under sysadmin

After building and deploying a new CentOS 6.2 server yesterday, I have been setting it up to act as a MySQL master for replication. I have made the necessary changes to /etc/my.cnf and added some optimisations.

When I tried to restart the mysqld service I received the error "MySQL Daemon failed to start." which comes from the init script. Not particularly helpful for identifying the problem and the error log wasn't much better:

120203 10:08:04 [Note] /usr/libexec/mysqld: Normal shutdown

120203 10:08:04 [Note] Event Scheduler: Purging the queue. 0 events
120203 10:08:04  InnoDB: Starting shutdown...
120203 10:08:09  InnoDB: Shutdown completed; log sequence number 0 44233
120203 10:08:09 [Note] /usr/libexec/mysqld: Shutdown complete

120203 10:08:09 mysqld_safe mysqld from pid file /var/run/mysqld/ ended

In order to troubleshoot mysql problems it is helpful to attempt to start MySQLd manually and make it a bit more verbose. To do this run the following command as root:

[root@server / ]# /usr/libexec/mysqld --user=mysql --verbose

120203 10:14:44 [ERROR] /usr/libexec/mysqld: unknown option '--skip-bdb'
120203 10:14:44 [ERROR] Aborting

120203 10:14:44 [Note] /usr/libexec/mysqld: Shutdown complete

Now that is a bit more helpful. In this example I have used an option "skip-bdb" which is now deprecated. Removing that from /etc/my.cnf fixed allowed the service to start without error.