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.

2 Answers 2


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.


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


Your Answer

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

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