• Hello,

    I recently built a wordpress site locally using Xampp. I had to reformat my computer so I backed up all the files in the Xampp WordPress htdocs folder. I had wrongly assumed it would be a relatively simple matter of copying over the htdocs content of my backup and pasting it the htdocs folder of the new install.

    I get an ‘error establishing a database connection’ message though and I’m not sure how I can fix it.

    Please help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • While you can restore the files, you won’t have any of the content. The content was stored in your database. That isn’t stored in the htdocs folder, so it’s gone for good.

    I get an ‘error establishing a database connection’ message though and I’m not sure how I can fix it.

    The wp-config.php file you backed up from the htdocs folder has a database name, database username, and username password stored in it from your old installation. WordPress is trying to connect to a database that no longer exists.

    You can use phpMyAdmin to create a database and user with the same name and credentials as those that appear in your old wp-config.php file, but as I mentioned, that old database is lost, so you won’t see any of the old content.

    Thread Starter razielx7

    (@razielx7)

    I’ve pretty much rebuilt everything I lost. Didn’t have that much to do.

    How can I do a proper backup to ensure this doesn’t happen again?

    There are two ways of backing up that I’d recommend:

    1. Within your WordPress Dashboard, go to Tools > Export to save your posts and pages. That way, in case you ever have to do a fresh re-install, you can do that, and then import your previous export.

    2. In addition to backing your files, you need to back up the database itself. In XAMPP, you should have a way to access the MySQL database through http://localhost/phpmyadmin

    You can use phpMyAdmin to export a copy of your full WordPress database as well.

    There are some in-depth instructions and great tips in this article as well: WordPress Backups

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Restoring local WordPress install’ is closed to new replies.