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.

I copied the data out of my /var/lib/mysql directory which has my database raw data in folders and has things like:

table1.frm
table1.MYD
table1.MYI

is this enough to re-import the databases to a fresh install of MySQL? Because I am about to re-image the server. if not, what should I do ?

Thanks!

share|improve this question
add comment

4 Answers

Make sure you're using the same EXACT version of MySql. .myd contains the data, .frm contains the table structure, and .myi contains the index for your data.

Don't forget to recheck the database using mysql's check table statement.

I've had some success repairing an old mysql version corrupted database without the .myi file.

share|improve this answer
add comment

The best option by far is to dump the existing databases to one or more text files and then import it/them into the new system. Mysqldump is the tool to use.

share|improve this answer
add comment

I just uploaded all the .MYD, .frm and .MYI files from a MySQL 4 server to a server running MySQL 5.

At first I took the advice I've seen on this site, and didn't copy the .MYI files. I ran a phpmyadmin repair and it said the .MYI files were missing. It didn't re-create them. So I went ahead and copied them over and ran the repair again and everything looked perfect. I was able to browse the tables and see that all the data was intact. And phpmyadmin gave green check marks next to every table.

I haven't had a chance to test the site yet to verify that it's all working, but I'll write back and let you all know.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.