Linux > General Linux

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

(1/1)

Chetan Singh:
HI,

Some time we are getting this error while starting/restarting MySQL service. It's because of MySQL data directory is not set correctly or MySQL data directory's path has changed. When you look in to the /var/log/mysqld.log file you can see the following errors:

=================>>>
/usr/libexec/mysqld: Table 'mysql.plugin' doesn't exist
120907  5:04:43 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
120907  5:04:43  InnoDB: Initializing buffer pool, size = 8.0M
120907  5:04:43  InnoDB: Completed initialization of buffer pool
120907  5:04:43  InnoDB: Started; log sequence number 0 44233
120907  5:04:43 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
120907 05:04:43 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
=================>>>

Now, you need to find our what is correct path of MySQL data directory, it's very simple. You can get this information with the help of this command:

=================>>>
root@www ~]# whereis mysql
mysql: /usr/bin/mysql /usr/include/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz
[root@www ~]#
=================>>>

You can see that the MySQL data directory path is showing "/usr/include/mysql", you need to configure your MySQL configuration file accordingly. Open MySQL configuration file via VIM editor and change/add "datadir" directory.

=================>>>
#vim /etc/my.cnf

datadir=/usr/include/mysql
=================>>>

You have done now, please restart MySQL service and check this. I am sure it will start without any errors.

Enjoy:-  8)

Thank you,

Navigation

[0] Message Index

Go to full version