Restore Deleted Database on Godaddy

I was doing a little maintenance on my Godaddy account and committed a MAJOR screwup. I had moved a WordPress page from a subfolder onto the main drive of a domain. Godaddy was still showing it in my development location. I thought it was a different one, and after checking that there were indeed no files in that drive that would be accidentally deleted, I removed that WordPress installation along with its associated database. As I clicked the button, the thought passed through my mind that it might be deleting the database that was being used by the main site. I quickly tried to stop the process, but it was too late. Sure enough, my WordPress website database was gone. The files were still on my server since Godaddy was looking in a subfolder.

How do you fix the problem if you delete your WordPress database on Godaddy?

I tried a few things that didn’t work:

  1. After doing a Google search for the problem, I found a forum on Godaddy that addressed that problem. It said to go into your Hosting Manager and into the MySQL page to locate the database and restore it. That is not possible, since after deleting the database it was no longer in the list.
  2. I tried creating a new database with the same name and login information and then using the Hosting Manager > MySQL page to restore it. I was able to go into the database and see the correct information in there, but it wasn’t connecting with my WordPress page properly. I tried editing the wp-config files but that didn’t work either. If you try this and it doesn’t work, make sure you delete the database afterwards.

Here’s what finally worked:

  1. Locate the backup SQL file on your server at /_db_backups. Copy it to your local drive (like your desktop). Fortunately, before I started messing with anything I had backed up EVERYTHING, so that backup file was current.
  2. Locate your WordPress files. You need the 3 folders – wp-admin, wp-content, wp-includes, and all of the other files in the directory with it. This should be located wherever you installed WordPress. In my case it was in the webpage root directory. Using your FTP client, copy all of these files to your local drive. (Like a folder on your desktop) Hopefully you had a backup before you started messing with stuff.
  3. Delete the files from step 2 from your server so you can do a new clean WordPress installation.
  4. Reinstall WordPress like you did originally – I used Godaddy’s Hosting Connection to do this. It creates fresh files on your server and a new, clean database.
  5. Go into the Hosting Manager > MySQL > phpMyAdmin for your new database.  Click the Export tab at the top.  Under the Export Type, choose REPLACE. Click Go.
  6. You will see the export on the screen. Select somewhere in the text and hit Ctrl+A to select all of the text. Copy it and go to your desktop. Right-click the desktop and make a new text document. Name it whatever you like. I used my webpage name. When the file opens, paste the SQL in there. Then do a Save As. Name it with a .sql extension. (So webpage.sql instead of webpage.txt.) Then – this is important – Set the encoding to UTF-8. If you don’t do this, it won’t import properly if you need it to.
  7. Then, open your backup SQL from step 1 and your exported SQL from step 6. Copy the Host and the Database name from the exported SQL into the backup SQL. Save.
  8. Go back into the Hosting Manager > MySQL > phpMyAdmin for your new database.  Click the Import tab at the top. Browse and locate your backup SQL from step 1 modified in step 7. Click Go. Let it run. Depending on how much data you had in the database, it could take a while.
  9. Using your favorite FTP client, copy your new WordPress files from the server to a folder on your desktop. This is a backup in case something goes wrong.
  10. Using your favorite FTP client, copy everything EXCEPT the wp-config.php and wp-configsample.php files from your original download in step 2 onto your directory, overwriting the files that exist on the server.
  11. Assuming you didn’t mess anything up like changing your username and password, everything should be working fine now.

Exceptions:

The reason those steps worked for me are because I had:

  1. A recent backup of my database.
  2. Access to all of my WordPress files on my server
  3. I remembered all of my usernames and passwords.

If you do not have these, it gets complicated.

  1. If you don’t have a database backup, you have 2 options. Either call Godaddy and pay them around $150 to restore your mistake or start over and manually add all of your content again.
  2. If you have your database backup but lost your WordPress files, you will have about half the work ahead of you. Do everything else I told you above, but you’ll have to redo all of the WordPress settings, including your themes and plugins. But at least you don’t have to type in all of your content again.
  3. I strongly recommend a good system for usernames and passwords. I use Lastpass. It’s wonderful and highly secure.

Author: Steph

Share This Post On

Pin It on Pinterest

Share This