No announcement yet.

Error Establishing a Database Connection

  • Filter
  • Time
  • Show
Clear All
new posts

  • Error Establishing a Database Connection


    I am facing error of database connection on my site.

    Click image for larger version

Name:	wordpress.png
Views:	1
Size:	21.1 KB
ID:	189

    Can anyone please help how to remove this error.
    Last edited by Neha; 11-19-2017, 05:26 PM.

  • #2

    Possibly there could be two reasons, the database username and password are incorrect in the wp-config.php file or the database is corrupted.

    Please make sure that you have correct database credentials under wp-config.php

    Let me know the control panel you are using so we can help you with the exact steps?
    Lalitkumar Waghulkar | Business Development Executive.
    T: +91-253-2313625 | M: +91-8888889939 | Skype: lalit_403


    • #3

      The control Panel which I am using is cpanel.


      • #4
        Thanks I have resolved it.


        • #5
          If it's a WordPress website then you must follow the steps provided below:

          Step 1. check the wp-config.php file and look for the similar code shown below.

          /** The name of the database for WordPress */
          define('DB_NAME', 'vidavibe_xxxx');
          /** MySQL database username */
          define('DB_USER', 'vidavibe_xxxx');
           /** MySQL database password */
          define('DB_PASSWORD', 'X834547Y&$pD9');
          /** MySQL hostname */
          define('DB_HOST', 'localhost');

          Note** : For MySQL Host, assuming you are using local MySQL server.

          Step 2. Make a note of the database name, database user, and password in a notepad.

          Now that you have all the necessary details, you can login to cPanel account of this user.

          Step 3: Go to cPanel >> MySQL® Databases >> Under Current Databases >> look for the database name that we have found from wp-config.php file. In our case, it is "vidavibe_xxxx"

          Click image for larger version

Name:	wp1.png
Views:	2
Size:	77.3 KB
ID:	784

          Step 4: Check if the database name is correct and user in front of it under Privileged_users is correct too.

          Click image for larger version

Name:	wp2.png
Views:	2
Size:	14.9 KB
ID:	785

          Step 5: Thereafter, move to 'Current Users' >> In front of the username, you will find an option to 'change password'

          Click image for larger version

Name:	wp3.png
Views:	2
Size:	45.1 KB
ID:	786

          Step 6: Upon clicking change password, you will be asked for new password. >> Enter the password same as that we found in the wp-config.php file i.e X834547Y&$pD9 >> click on change password.

          This should fix database connection error on your WordPress website !!!

          The above steps are for WordPress website. If you are using any other application then you will need to check for the database connection string. The rest steps from cPanel remain the same as discussed above.
          Last edited by Mandeep; 09-18-2018, 12:41 PM.