Restore Mysql Database from the .frm .MYI and .MYD files
Posted on Wed 23 September 2009 in misc
OK so you have a mysql database that you have recovered from a backup. However, whereas you would normally have a nice sql dump to deal with, on this occasion you only have the .frm .MYI and .MYD files. Can you rescue that table the client has deleted? Indeed you can!
#> cd [where you databases are kept, possibly /var/lib/mysql ]
#> mkdir [name of database to rescue]
copy the .frm .MYI and .MYD files into it.
make sure the permissions are ok. Something like this
#> chown -R mysql:mysql [dbname]
#> chmod -R 700 [dbname]
Now if you are lucky, you should be able to do this:-
#> mysql -u root databasename -e "SHOW TABLES;";
#> mysqldump -u root databasename tablename