How to fix “Error establishing database connection” in WordPress
The error “Error establishing database connection” means that your wp-config.php file does not contain valid database credentials. To fix this problem you will need to go to the wp-config.php file and you will see the database configuration section:
// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', 'SCWORDPRESS-33426930ea'); /** MySQL database username */ define('DB_USER', 'SCWORDPRESS-33426930ea'); /** MySQL database password */ define('DB_PASSWORD', 'eb07bfe05d3240-example'); /** MySQL hostname */ define('DB_HOST', 'wordpressdb-i.hosting.stackcp.net');
Make sure that the four sections correspond to the database details that you will find in the administration panel in the MySQL Databases section.
It is recommended that you copy the password from the wp-config.php file and set the database password to the same one to make sure it matches.