[Klug-general] Restoring sql backups not all rows restoring

Laurence Southon laurence at southon.uk.net
Wed Aug 13 11:45:16 UTC 2014


On 13/08/14 09:13, Nathan Friend wrote:
> If your having trouble with the import just copy the files from on the
> source server.  Shutdown MySQL first then tar up /var/lib/mysql directory.

If you need to keep the source database live, a work around I've used is
this:

rsync /var/lib/mysql, while mysql is running, to a location preferably
on the same partition so it's fast. Don't worry that the files will be
inconsistent.

Open two consoles: bash and a mysql console

In the mysql console issue 'LOCK TABLES;'

In the bash console rsync /var/lib/mysql again. This second time will
only be the changes so it will be fast, probably only a few seconds.

The moment it finishes issue 'UNLOCK TABLES;' in the mysql console.

At your leisure scp, netcat, tar or whatever the rsync'd copy of
/var/lib/mysql to the other server.

LS
-- 
Laurence Southon
Tiger Computing, Bexley
www.tiger-computing.co.uk



More information about the Kent mailing list