• I am using Heroku to host my wordpress site, and attempted to restore my local wordpress environment from a remote backup (https://devcenter.heroku.com/articles/heroku-postgres-import-export#export). The import to the local DB worked fine, but when I fire up localhost, I get the infamous “Error Establishing a database connection” message.

    Prior to the import, I made a backup of my local DB, and after a bit of [unsuccessful] troubleshooting, I restored the backup to the local DB. Unfortunately, I am still getting the error message when attempting to load up localhost. My wp-config.php file has not been altered, and FWIW my remote database connection (on Heroku) is still working fine.

    Any help is greatly appreciated.

Viewing 6 replies - 1 through 6 (of 6 total)
  • To clarify, you’re trying to take a backup from your Heroku database and import it into a local install of MySQL?

    If you’re trying to set up a localhost version of WordPress, you need to modify your wp-config.php to point to the proper location of the MySQL server on your local machine with the right credentials. Also verify that MySQL is running and listening.

    Thread Starter agibson22

    (@agibson22)

    The localhost version was working just fine. Then, I imported the DB data from my remote host (Heroku), and it caused the problem.

    More troubling, I then restored my localhost DB from a previous localhost DB backup (made prior to any import/export from Heroku), and it still does not work. This is what is more confusing to me. The wp-config.php file has not been modified locally (verified with a simple ‘git status’). Hence, the configuration and DB that were working are no longer working.

    The DB server is running locally and can be accessed with the user credentials (Postgresql, in this case, verified by connecting with the psql command line tool).

    Have you checked the error logs?

    Thread Starter agibson22

    (@agibson22)

    Yes. The php_error.log is clean (I tested to see if it was working by breaking something and running it, and yes, it is outputting errors). The WordPress debug.log is also clean (again with the same type of test and yes it is outputting errors).

    Have you tried deleting the database and re-creating it?

    When you move a site, you must replace the old URLs and paths with the new ones. Some of these are stored in the database in ‘serialized’ form where the string length is stored along with the string. You must use special tools to search and replace the old values with the new ones.

    If you replace an old URL with a new one of a different length, it will break the serialization, causing many different problems.

    If the old site is still available, you can use the steps shown in this article to copy the site: http://wordpress.mcdspot.com/2012/08/22/migrating-a-wordpress-site-step-by-step/

    If the old site is not available, and you still have a copy of the database from that site, you should be able to use this tool to make the changes: http://interconnectit.com/products/search-and-replace-for-wordpress-databases/

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Remote DB Backup to Localhost’ is closed to new replies.