Recover MySQL Data From Files


The best way to backup and restore from MySQL is using Workbench or mysqldump however this may not be possible if the system is trashed but have HDD data in tact. As a last resort the files can be recovered and restored.


In Ubuntu 10.04 and 12.04 the database files are stored in /var/lib/mysql. Each schema has it’s own directory named after the schema.

First stop MySQL service:
sudo service mysql stop

Copy the directories to the new computer but exclude the mysql folder or it will cause issues.

Start MySQL again:
sudo service mysql start

Once restored it’s best to perform a backup and re-create the tables to prevent any file permission issues.


A quick and easy way of recovering database from file system.

About Danny

I.T software professional always studying and applying the knowledge gained and one way of doing this is to blog. Danny also has participates in a part time project called Energy@Home [] for monitoring energy usage on a premise. Dedicated to I.T since studying pure Information Technology since the age of 16, Danny Tsang working in the field that he has aimed for since leaving school. View all posts by Danny → This entry was posted in Database, Linux and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *.

All comments must go through an approval and anti-spam process before appearing on the website. Please be patience and do not re-submit your comment if it does not appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.