Panic! Mysql is not starting!

Last Tuesday I found an issue a still did not found in which mysql was not starting. Looking at the logs showed this logs:

Fatal error: Can’t open and lock privilege tables: Can’t find file: ‘host’ (errno: 2)

Ok, so what should we do now? Well, case you had (something I would recommend to backups for /var/lib/mysql you could restore /var/lib/mysql/mysql

If not, do not worry, you’re still not lost (or not too much)

First you have to manage to run mysql, even without such table. for doing so just run:

mysqld_safe --skip-grant-tables

So now mysqld is running, and now? just use the sql command restore:

mysql
mysql> use mysql
mysql> REPAIR TABLE host ;

Many times this command won’t be working so you can still use:

mysql> REPAIR TABLE host USE_FRM;

Once done this. restart your mysqld and you will be up and running!

Deja un comentario