Skip to main content
All CollectionsTroubleshooting
Error Establishing a Database Connection
Error Establishing a Database Connection
Updated over 2 months ago

This error means that WordPress is unable to establish a connection to your database, which is typically caused by incorrect credentials, database corruption, or server-related issues. Below are the steps to troubleshoot and resolve the problem.

  1. Verify the Database Credentials in the wp-config.php File

    Begin by checking the credentials stored in your WordPress configuration file

    a. Login to EVCloud

    b. In the Websites section, select your website and open File Manager.

    c. Navigate to your WordPress root directory (usually located in /public_html/).

    d. Find and open the wp-config.php file for editing, you will find entries like:

    define('DB_NAME', 'your_database_name'); 
    define('DB_USER', 'your_database_user');
    define('DB_PASSWORD', 'your_database_password');
    define('DB_HOST', 'localhost');

  2. Verify Database Details in the EVC panel

    Once you've reviewed the database credentials in the wp-config.php file, verify that they match the correct details for your actual database.

    a. In the panel, head to your website and select databases

    b. Verify that all details such as DB_NAME, DB_USER and DB_PASSWORD, from wp- config.php matches an existing database in this list.

    If any of these details doesn't match, you’ll need to update them in the wp-config.php file to reflect the correct database name and username. You can also create new users under the Database users section

  3. Reset the MySQL User Password

    If the database details are accurate, the most common issue could be related to the database password. In this case, you can reset the MySQL user's password and update it in the wp-config.php file accordingly.

    a. Navigate back to Database users section

    b. Choose the user for whom you wish to change the password

    c. Click reset on the top-right of the block, and choose a new password in the input field

    d. When done, select "Change password". Then update the DB_PASSWORD in your wp-config.php file with the new password.

  4. Ensure MySQL user has proper permissions

    a. Go back to the Database users section

    b. Select the user you wish to edit priviliges for.

    c. Scroll down and find the Database access section

    d. Click the kebab menu (three vertical dots) on the right side and select "Edit privileges"

    e. Tick the box "All database privileges"

    f. Save and exit

    This grants the MySQL user full access to the database, ensuring everything functions correctly.

Did this answer your question?