Error establishing a database connection After Copy localhost wordpress site (with site url directly to hosting server’s url before copy)

Read http://codex.wordpress.org/Moving_WordPress#When_Your_Domain_Name_or_URLs_Change

You’ve only moved the PHP files. That is only part of the process.

Migrating the databse would mean:

  1. Create a database, if there isn’t one already
  2. Move the database from your local server to the remote one.
  3. Edit/alter key values in the database
    1. The same wp-config editing trick used here will get you much of the way but won’t fix any URLs that are probably in the database.
  4. A plugin called Velvet Blues Update Urls is very good for sorting out broken URLs after a move.

That is the hard way, but your attachments are likely to survive. You could have trouble if the MySQL versions between you local install and your host are different.

The easier way is this.

  1. Create a database on the remote server.
  2. Allow WordPress to install itself just like you did when you initially created the local site.
  3. Use the WordPress exporter at Tools->Export to export everything from your local install
  4. On the remote install, Import what you just exported. You will need to install the WordPress importer plugin
  5. Import your posts
  6. A plugin called Velvet Blues Update Urls is very good for sorting out broken URLs after a move.

The benefit is that the database is clean and fitted to your new host. The drawback is this: While the importer will offer to download and install your attachments, it won’t be able to do so from a “local” address.

While I have done and it does work, I prefer the latter, for what it is worth.

Caveat: I cannot swear that I’ve remembered everything you will need to do. Go through the Codex page very carefully before doing anything.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)