Monday, 10 December 2012

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

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



Continuing with the MySQL mini posts I ran into this error today while setting up our redundancy servers. I moved the mysql directory out of it’s default location of /var/lib. So when I went to start Mysql it would fail. When I looked in the /var/log/mysqld.log I seen the following:
Fatal error: Can’t open and lock privilege tables: Table ‘mysql.host’ doesn’t exist
To fix this issue you simply just have to tell mysql where to look not that the default installation is moved. You can do that with:
mysql_install_db –user=mysql –ldata=/newlocation
once you do that you can restart mysql
/etc/init.d/mysqld restart

For example :====


./mysql_install_db -user=mysql -ldata=/usr/local/mysql-5.5.28-linux2.6-x86_64/data --basedir=/usr/local/mysql-5.5.28-linux2.6-x86_64


/usr/local/mysql-5.5.28-linux2.6-x86_64/bin/mysqld_safe --defaults-file=/etc/my.cnf &


                  $$**************Posted by Shishir Tekade**********$$

No comments:

Post a comment