0

The primary HDD drive of my computer died yesterday, I got a new one and restored it but when I went to restore my mysql databases I realize I had no done a proper backup in a while. Nevertheless, I do have the original database files from my previous installation as the datafiles were in the second HDD.

My question is, can I restore/create a new DB in the new machine using only the files from the previous installation?

Thank, Ignacio

ignacio
  • 245
  • 2
  • 12
  • Did you try answers to [Restoring MySQL database from physical files](https://stackoverflow.com/questions/484750/restoring-mysql-database-from-physical-files)? – Damian Yerrick Aug 14 '15 at 22:14

1 Answers1

0

Yes, you should be able to do this.

I'm a bit unclear: when you say, "I do have the original database files" do you mean as a database? If so, go to phpMySql for the surviving database and choose Export. Export the database as a text file. Open the file with your favorite text editor and change the name of the database to match the name you are importing into.

Create the empty database where you want the new one to be, if it doesn't already exist. Now go to phpMySql for that database and import your text file. This should recreate all the tables and their data in the new location.

If instead, you only have the files that were the source of the data, then you need to use whatever tool was used to create the database in the first place. For example, if the data is in the form on an Excel spreadsheet, you would use MySql for Excel.

Hope this helps!

(after your comment that you have file backups of WordPress site)

In that case, you may not be so lucky. If you used a tool to do your backup, it may have backed up the database, but in general, the database is stored separately from your file system. So if you just copied the files yourself, you won't have the database. But do look for any file with a suffix of .SQL, which would be a database backup.

Next, contact your Internet Service Provider and see if they do periodic database backups. If so, you can recover from them.

For the future, see if your ISP provides automated backups (including database). And read https://codex.wordpress.org/WordPress_Backups.

WahhabB
  • 520
  • 3
  • 8
  • Hi Thanks for your answer, "Original db files" means that I was doing a backup of the folder where the database where located originally. So I have a folder named 'MyWordpressSite" with files like: db.opt wp_posts.frm etc (It was a wordpress site) Thank, Ignacio – ignacio Aug 15 '15 at 02:14
  • In that case, you may not be so lucky. If you used a package or a tool to do your backup, it may have backed up the database, but in general, the database is stored separately from your file system. So if you just copied the files yourself, you won't have the database. But do look for any file with a suffix of .SQL, which would be a database backup. – WahhabB Aug 16 '15 at 02:32
  • Next, contact your Internet Service Provider and see if they do periodic database backups. If so, you can recover from them. For the future, see if your ISP provides automated backups (including database). And read https://codex.wordpress.org/WordPress_Backups. – WahhabB Aug 16 '15 at 02:42