Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to restore on another Ubuntu computer a MySQL database backup made by rsnapshot on an external USB hard disk? This seems to be difficult because the UID and GID of mysql differ on both computers.

I could work around by determining UID and GID of mysql on the target computer, copying the database in /var/log/mysql/ and running the command ~$ chown -R newuser:newgroup newdir.

Is there a more straightforward solution?

[Backup on Ubuntu 12.04, Restore on Ubuntu 10.04.4]

share|improve this question
Also, try asking at Database Administrators. – hexafraction Aug 6 '12 at 16:13
up vote 0 down vote accepted

The solution to this is to make a mysqldump and restore from that.

mysqldump -u root -p > iamateapot.sql should save everything in mysql into iamateapot.sql stored in the current working directory.

Transfer that .sql to the other server, do mysql -u root -p < iamateapot.sql, and it'll overwrite all current MySQL data on that server with new data, and retain all users, pws, etc. At least it should.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.