Moving WP from local server to live, error establishing a db connection

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.

Read More

What am I doing wrong?

Related posts

Leave a Reply

5 comments

  1. 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.

  2. 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 );
    
  3. 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!