Restore an accidentally deleted WordPress database

wordpress

#1

I mistakenly deleted a WordPress database. Fortunately I realized my error before the recycle bin got purged, and was able to restore it. The restore was apparently successful — it appears in my list of databases, and shows a size of 1.6MB. However the WordPress site is unable to connect to it.

I assume I need to make some repairs via phpMyAdmin, but I don’t see a hostname listed for this site. Do I simply create a new hostname and link them up somehow, or is it possible (and safer?) to restore the old one?

Also I notice that the restored database has a “_1” suffix. I don’t recall whether that was its original name or if the restoration process automatically renames it to avoid overwrites.


#2

You can restore databases with a couple of different options.
Try doing it again and choosing the 4th option: My restored tables should be named tablename and the tables there now should be overwritten by the backups! and WP should be able to find the DB again.

Or…

Go to the your WP config.php page - in the root of your site and update the name of the database, adding the new _1

Or, yeah, you could also rename it in phpMyAdmin.


#3

Thanks, artgeek!

I went to the wp-config.php file and confirmed that the current name of the database is unchanged – it already had the “_1” suffix.

I also saw that the MySQL settings block in wp-config.php includes a hostname. I no longer had a hostname for this database – it was deleted along with the database. I created a new one via the dreamhost panel, logged into it via phpMyAdmin, and selected the restored database. Apparently that’s all that was required.