1

Not sure what's going on here 'cos I've done it already a couple of times and it always worked. Basically I'm moving a testing site from my local machine (MAMP) to a live server by:

  • zipping the entire WP directory and uploading it to the server
  • exporting db from localhost
  • creating empty db on the server and importing the sql file
  • updating wp-config file with the new credentials

When I try to access the site it gives me "Error establishing a database connection". I tripple checked the db details (db name, user, pass) and even log in via terminal using those credentials.

What am I doing wrong?

2
  • You can log in to what via Terminal? Just the server or to the DB itself via command line?
    – Ipstenu
    Oct 25, 2012 at 22:21
  • I can log in straight to the DB via command line
    – Jkulig
    Oct 26, 2012 at 17:47

5 Answers 5

2

I've found that I need to change the siteurl and home entries in wp_options when I move from local to a live server. Not sure that should affect a connection to the database though.

1
  • yes, that was exactly it... well aside from that small DB_HOST issue. Thanks Dustin for this very helpful info. That really saved me a lot of unnecessary work.
    – Jkulig
    Oct 26, 2012 at 18:10
0

In your wp-config.php, define WP_DEBUG as true, that should give you a more detailed error message. Also, make sure you have error reporting turned on if that doesn't seem to give you what you're looking for - you should get a message like 'Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: YES) in...'

define( 'WP_DEBUG', TRUE );
ini_set( 'display_errors', TRUE );
1
  • thanks postpostmodern for the info, that sorted out half of the problem - turned out I accidentally deleted DB_HOST from wp-config file. It's still giving me an error though - Err 109: Unable to reach server. At least I know it's not the DB issue anymore
    – Jkulig
    Oct 26, 2012 at 17:54
0

there is a plugin that may help http://wordpress.org/extend/plugins/developer/

This plugin will help you optimize your development environment by making sure that you have all the essential tools and plugins installed.

The plugin will walk you through auto installation of helpful tools like Debug Bar and VIP Scanner.

It might help

0

Personally, the only 100% bulletproof method I've used for this operation is a migrate script that preserves serialized data in the databased during export/import.

However, it's also available as a plugin now - so it seems life is already easier :)

http://wordpress.org/extend/plugins/wp-migrate-db/

0
0

To sum up this thread here's one of the ways to manually move WP installation from localhost to live:

  1. zip the entire WP directory and upload to server
  2. mysqldump local database
  3. create new database on the server and import database from previous step
  4. update database values in wp_options table: siteurl and home (change paths from localhost to live server)
  5. update /wp-config.php file with new db access details

Thanks again for all the help to all the users that contributed to this thread!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.