soozh
asked on
Problem after moving mysql database
Hello,
When the IT dept set up my Linux server with MySQL they set the data directory to /var/lib/mysql
Now the system disk is full.
So there is a disk with loads of space which i have copied of the database to using:
cp /var/lib/mysql /data
then i edited the my.cnf file and changed the row that Points to the database to:
datadir = /data
I deleted some old log files to create some space.
Then i restarted the server.
But i now get an error message in mysqld.log that says:
Fatal error: Can’t open and lock privilege tables: Table ‘mysql.host’ doesn’t exist
How can i solve this? I have seen examples that say you can use:
mysql_install_db –user=mysql –ldata=/newlocation
but i just want to be certain i am not doing a total new install by type in that command.
I know nothing about Linux/MySQL so keep you answers to beginner level!
When the IT dept set up my Linux server with MySQL they set the data directory to /var/lib/mysql
Now the system disk is full.
So there is a disk with loads of space which i have copied of the database to using:
cp /var/lib/mysql /data
then i edited the my.cnf file and changed the row that Points to the database to:
datadir = /data
I deleted some old log files to create some space.
Then i restarted the server.
But i now get an error message in mysqld.log that says:
Fatal error: Can’t open and lock privilege tables: Table ‘mysql.host’ doesn’t exist
How can i solve this? I have seen examples that say you can use:
mysql_install_db –user=mysql –ldata=/newlocation
but i just want to be certain i am not doing a total new install by type in that command.
I know nothing about Linux/MySQL so keep you answers to beginner level!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the help. I did want sandy suggested but i had copied the wrong directory level. So now everything is working. Thanks for the help.
Usually when you it this error of missing table you would run "mysql_upgrade -p"
That would fix the problem with this table