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]
The solution to this is to make a mysqldump and restore from that.
mysqldump -u root -p > iamateapot.sql
should save everything in mysql intoiamateapot.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.