Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
Just for future reference, the do-release-upgrade tool is generally a nicer way of getting to a new release. –  Shane Madden Apr 29 '11 at 21:30

1 Answer 1

up vote 1 down vote accepted

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!

share|improve this answer
    
MySQL was running when the backup was performed. What implications does that have? –  mejpark Apr 30 '11 at 8: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 1 '11 at 2:38
    
Thanks. I shall stop all servers before next backup. –  mejpark May 2 '11 at 11:44

Your Answer

 
discard

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.