Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
    
You can log in to what via Terminal? Just the server or to the DB itself via command line? –  Ipstenu Oct 25 '12 at 22:21
    
I can log in straight to the DB via command line –  Jkulig Oct 26 '12 at 17:47
add comment

5 Answers

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.

share|improve this answer
    
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 '12 at 18:10
add comment

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 );
share|improve this answer
    
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 '12 at 17:54
add comment

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

share|improve this answer
add comment

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/

share|improve this answer
    
thanks Trollsyn, I might try that if all else fails –  Jkulig Oct 26 '12 at 17:54
add comment

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!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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