Friday, July 12, 2013

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


Problems:
130702 12:48:19 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
130702 12:48:19 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

Solution:
Step 1   Change “datadir” option to new directory i.e. /abcdb
           # vi /etc/my.cnf
[mysqld]
datadir=/abcdb
socket=/var/lib/mysql/mysql.sock
user=mysql
symbolic-links=0
 
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
 
Step 2   Change ownership “mysql” of “/abcdb” directory.

Step 3   Disable selinux

 Step 4   Run below command:

                #mysql_install_db -user=mysql -ldata=/abcdb

Step 5   Restart the mysqld service