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


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 ?



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.


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.


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy