Most affordable 24×7 server management plan including 24×7 monitoring, security audit and much more  Server Management Services 

If you are getting “Error establishing a database connection” the first thing you need to check is if MySQL is up. If MySQL server is not up please follow this link to troubleshoot it The MySQL® server is currently offline

If it is up and running fine the problem is with the MySQL credentials.

If you have ssh access you can check MySQL credentials using the below steps from the command line.

Suppose that your database details are

Username iservers_user

Database iservers_db

Password testpass

Host localhost

You can check from command line as below.

root@server [~]# mysql -u iservers_user -p'testpass'
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 466965
Server version: 5.5.36-cll MySQL Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| iservers_db |
+--------------------+
2 rows in set (0.00 sec)

 

In the above example you can see that we have logged into MySQL from command line using the mentioned credentials “show databases” its showing the right database.

If you are already using right database credentials you need to make sure that the credentials are same in your website config file.

For example WordPress credentials are saved in wp-config.php

/** The name of the database for WordPress */
define(‘DB_NAME’, ‘iservers_db’);

/** MySQL database username */
define(‘DB_USER’, ‘iservers_user’);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘testpass’);

/** MySQL hostname */
define(‘DB_HOST’, ‘localhost’);

Once these things are corrected the error will be disappeared