What to do when "Error establishing database connection" occurs

If an "Error establishing a database connection" occurs, the possible causes are as follows.

  • Wrong connection information in wp-config.php (when using WordPress)
  • The database connection limit has been reached due to a plug-in, etc. (when using WordPress)
  • Insufficient privileges to use the database
  • Server failure

Wrong connection information in wp-config.php

If you are using WordPress, please check if the wp-config.php of the domain where the error occurred matches the DB settings on the cPanel side.

STEP 1: Log in to cPanel.

Log in to cPanel.

STEP 2: Click File > File Manager.

dbce001.png

STEP 3: Move to the document root of the domain where the error occurred.

STEP 4: Place the cursor on the wp-config.php file, right-click and click View.

STEP 5: Check wp-config.php information.

There are 4 points to check here.

①DB_NAME: Database name

②DB_USER: The user name of database login information

③DB_PASSWORD: Password for database login information

④DB_HOST: Hostname

Make a note of the DB_NAME, DB_USER, DB_PASSWORD and

Make sure DB_HOST is 'localhost'.

dbce002.jpg

STEP 6: Click Database > MySQL Database from cPanel Home.

dbce003.png

STEP 7: Check the DB settings (database name, user name) on the control panel side.

dbce007.png

*The password is encrypted and cannot be viewed here.

STEP 8: Scroll down and click "Change Password" on the line of the user confirmed in STEP 7.

dbce004.png

STEP 9: Enter the password you confirmed in STEP 5 and click Change Password.

dbce005.png

The database connection limit has been reached due to a plug-in, etc.

If you have installed a plugin that connects to the database during operation, such as JetPack or WordPress Popular Posts, the database connection limit may have been reached.

Try disabling the plugin and see if the symptoms improve.

Insufficient privileges to use the database

This problem is likely to occur when you introduce an application that uses a database other than WordPress.

You can check the privileges that a user has for the database using the following procedure.

STEP 1: Log in to cPanel.

STEP 2: Click Database > MySQL Database.

dbce006.png

STEP 3: Click "Authorized User" for the database for which "Error establishing database connection" has occurred.

dbce004.png

STEP 4: If there are items that are not checked, check them and click "Change".

If all items are checked, there is no problem to move the page without performing any operation.

dbce008.png

Server failure

If there is a problem with the server, the customer cannot respond.

Please check the failure/maintenance information, and if there is no description, please contact support.

Was this article helpful?
1 out of 7 found this helpful