WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm wanting to make a version of my blog on my home computer that I can work on offline. I set up LAMP on my computer (running Ubuntu) and copied all of my files from my server (000 Webhost) with FileZilla. But when I try to access my site on my localhost, I get "Error establishing a database connection." I think I've figured out that it has something to do with MySQL, but I'm really new to all this and could be way off. Any help would be greatly appreciated. Thanks in advance.

share|improve this question
up vote 1 down vote accepted

Did you change your database settings in wp_config.php and copy your database to your local machine? You'll also need to use a text editor to search a dump of your database for any URLs pointing to the live site before importing it locally if you haven't done so already.

share|improve this answer

Change below setting in wp-config.php for local settings.

/** MySQL database username */
define('DB_USER', 'root');
/** MySQL database password */
define('DB_PASSWORD', '');
/** MySQL hostname */
define('DB_HOST', 'localhost');
/** MySQL dbname*/
define('DB_NAME', 'your_db_name');

Also you need to do find & replace for url (for e.g. Replace http://yourdomain.com to your localhost your_project_url in the dump sql file. then import that sql file to your_db_name


share|improve this answer

Your Answer


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.