Server Fault is a question and answer site for system and network administrators. 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

I have a now non-bootable install of Ubuntu. What files do I need to copy to backup all of the MySQL databases (including database users and permissions)?

share|improve this question
up vote 1 down vote accepted

Since you don't have any dumps, you want the files in /var/lib/mysql/<dbname>. Since the system won't boot, I would boot with a live cd a mount the hard drive read only.

It should be okay if the DB was not running when when it shut down. If it was running, there might be some corruption. There might also be some file system corruption since it won't boot. Here is a post on recovering databases when they are in a unclean state.

In the future, the proper way to backup databases (if you don't use special software for it) is to create a dump of the database, and then back up those dumps.

share|improve this answer
The link is broken for "Here is a post " – Mike Nov 22 '12 at 15:20

The database dumps.

You might be able to copy the data directory to another machine and stand up mysql there. But you will have better luck with actual dumps.

man mysqldump.

share|improve this answer
If it wasn't clear, I can't boot the OS that MySQL is on. I'm guessing that mysqldump wouldn't be able to help me without a running server. – erjiang May 26 '10 at 21:34
Yeah, that's why I mentioned the data directory that Kyle expanded on. – Nathan Powell May 26 '10 at 23:58

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.