How to restore mysql databases from /var/lib/mysql/user_database/ files only

bjdea1

Well-Known Member
Mar 6, 2003
83
1
158
Hi,
as the title asks. I recenlty had a hardrive failure and luckliy I can still access certian directories on this drive. I can still access the /var/lib/mysql/ direcoty which holds all the users databases and have backed all these up using tar.

Now what I need to know is how do you restore these database files to another server? I tiried simply untar'ing one of these to a new server - for one single user - and it stuffed up Mysql - it went offline.

So how can I get these database files to fully work on a new server? Please any help would be greatly appreciated.
 

kernow

Well-Known Member
Jul 23, 2004
1,020
62
178
cPanel Access Level
Root Administrator
Login to the old server via ssh and use rsync to transfer the databases to the new server. Example;
#rsync -avz --delete -e ssh /var/lib/mysql new_server/var/lib/mysql