Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Fatal error: Can’t open and lock privilege tables: Table ‘mysql.host’ doesn’t  (Read 16917 times)

0 Members and 1 Guest are viewing this topic.

Chetan Singh

  • Full Member
  • ***
  • Posts: 123
  • Karma: +2/-0
  • Bienvenido a las Tecnologías de la Admin-Ahead.
    • Admin-Ahead Server Technologies.
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,
Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!