Link to home
Start Free TrialLog in
Avatar of soozh
soozhFlag for Sweden

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!
SOLUTION
Avatar of Stampel
Stampel

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Stampel
Stampel

i suspect someone could have upgraded mysql without upgrading data and you are hitting this cause you did restart mysql what nobody did before.

Usually when you it this error of missing table you would run "mysql_upgrade -p"
That would fix the problem with this table
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of soozh

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.