Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 an old server backup with MySQL data files in /var/lib/mysql and I need to access the data inside of one of the databases inside that directory. I unfortunately don't have any SQL-dumps of the database. only these files.

The backed up files is from a MySQL-server with version 5.0.51a and the current server has the version 5.1.49.

I tried the obvious, stopping the MySQL-server, copying (while preserving permissions) the database directory from my/backup/folder/databasename to /var/lib/mysql/databasename and starting the MySQL-server again. That created the databases but they where empty.

How can I extract the data?

(I'm running the server on a Debian system)

share|improve this question
up vote 1 down vote accepted

This could cause issues long-term if you just copy the data files to a different version. It's usually strongly discouraged. The right way to do this is to install 5.0.51a somewhere, copy the data files there, do a dump and import them on 5.1.

share|improve this answer
Thanks, but now that I have done the import, is the data converted to 5.1.49 format? Or should I do an SQL-dump and import that SQL-dump to make it convert? – tirithen Oct 30 '11 at 13:08

I found the solution was that the files had the wrong ownership so after:

sudo chown mysql:mysql -R /var/lib/mysql/databasename

Everthing worked fine.

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.