2

Last night, I backed up my Ubuntu 10.10 box using the sbackup utility. The process ran with the default options, which backed up the /etc /home /usr /var directories to a separate partition on my machine.

After the backup completed successfully, I installed Ubuntu 11.04 over the existing Ubuntu 10.10 partition and installed the lamp-server meta package using tasksel:

$ sudo apt-get install tasksel
$ sudo tasksel install lamp-server

When prompted, I entered the same MySQL root password as used on Ubuntu 10.10.

What's the easiest way to restore the user accounts, databases and configuration from /media/backup/var/lib/mysql to the new installation?

Thank you.

unpossible
  • 218
  • 3
  • 9

1 Answers1

1

If MySQL was shutdown while you were doing the backup, you should be able to simply put the files back in place. In standard distributions, mysql data is located at /var/lib/mysql (you can check in the /etc/my.cnf for the actual path if it's different). So, I would:

  • shutdown mysql-server if it's running
  • move the current /var/lib/mysql folder to a safe place (even though it pretty much empty)
  • copy your backup from /media/backup/var/lib/mysql to /var/lib/mysql
  • restart mysql-server

done-ski!

Andre Lackmann
  • 426
  • 2
  • 5
  • MySQL was running when the backup was performed. What implications does that have? – unpossible Apr 30 '11 at 08:35
  • 1
    If you're using Innodb tables you can't be certain that all the data has actually been written to disk at any single point in time, as it caches in memory. That said, in practice is depends on how busy your server/site is, but in general, you don't want to do external file operations on your database servers data while it's running or you may end up with inconsistent results. – Andre Lackmann May 01 '11 at 02:38