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)

link|improve this question
feedback

2 Answers

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.

link|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
feedback

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.