MySQL Forums
Forum List  »  Install & Repo

Re: Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
Posted by: Harry Kim
Date: August 04, 2006 10:15AM

This thread is rather old, but I just installed 5.0.23 as a package on a Solaris 9 box and ran into the same issue, so I thought I would post something. What I found is that the mysql_install_db script has the data directory pointing to /var/lib/mysql, while the mysql binary defaults to /opt/mysql/mysql when it is run. This is bad because the mysql database gets created in /var/lib/mysql, while the mysql binary is looking for it in /opt/mysql/mysql/data. There are three solutions to this problem. As was suggested by a previous post, you can create a my.cnf file (see below) that points to /var/lib/mysql or where ever your data directory is. I found mine by doing a search for the file host.MYD. Make sure that both of these entries are correct or you will get another error (as I did). Put this file in your base directory.

In my.cnf:
[mysqld]
basedir=/opt/mysql/mysql
datadir=/var/lib/mysql

The other solution is to modify the mysql_install_db and change the location of the data directory to /opt/mysql/mysql/data or wherever the mysql binary thinks the default location is (see below). After you rerun the script, the mysql database should be in the correct location.

In mysql_install_db:
ldata=/opt/mysql/mysql/data

The last solution has been previously posted as well, but it works for the same reason the others do. If you start mysql with the mysql.server script in the support-files directory, it points to the same data directory that is listed in the mysql_install_db script. Which means that if you use solution #2 AND #3 together, you will have to modify the mysql.server script to reflect the correct data directory.

This information is pretty much contained in all of the previous posts, but they really didn't give you the whole picture. At the very least, I hope this will give you some idea of where to start troubleshooting.

Options: ReplyQuote


Subject
Written By
Posted
Re: Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
August 04, 2006 10:15AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.