Can’t open and lock privilege tables: Table ‘mysql.db’ doesn’t exist

Fatal error: Can’t open and lock privilege tables: Table ‘mysql.db’ doesn’t exist

I faced this problem while I was shifting the location of mysql data directory to non-default location. I copied all the files from /var/lib/mysql(default data location) to the /data and changed path in /etc/my.cnf also.

When i tried to run the mysql service, It gave following error in /var/log/mysql/mysql.err

Fatal error: Can’t open and lock privilege tables: Table ‘mysql.db’ doesn’t exist

It seems like service was not able to locate some table in MySQL DB. Did few searches and found a solution:

Install MySQL DB again at new location,use following command:

mysql_install_db --user=mysql --ldata=/data
/etc/init.d/mysql restart

I hope this will save your time.

Be the first to comment

Leave a Reply

Your email address will not be published.


*


CommentLuv badge