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?
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.
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…‘
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
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/
To sum up this thread here’s one of the ways to manually move WP installation from localhost to live:
Thanks again for all the help to all the users that contributed to this thread!