Mysql – How to restore MySQL database from Files

mysql-5.1restore

Primary hard disk where MySQL (version 5.1) was installed is crashed and I had to re install entire OS. I have all the files including ibdata1 file. How do I go about recreating and attaching database to restore it to stage where it was crashed. Do i need log files or I can delete them ?. I am OK if some of the data I cannot restore. Important is I have all tables and most of the data possible.

Best Answer

  • install the new MySQL
  • create the db you want, let's say DB_NAME_RESTORE
  • go to /var/lib/DB_NAME_RESTORE and copy the data files there
  • chmod on the files if you have to