Web Hosting

Fixed – Error in Establishing Database Connection WordPress

By  | 

When you are trying to open your website and it is showing “Error in Establishing Database Connection”. Don’t Panic. Contact the Hosting Company or Raise the ticket regarding this issue. If you are a Hosting Provider or Manager and are you trying to solve this issue? Check the below points which is explained about the various possibilities for “Error in Establishing Database Connection”.

What is the Root Cause of this Problem?

The Error is because of the Connectivity Issue between the Database and the Server. Before doing anything we must confirm whether the Database of the website is in same server or at different location. If the Database is in same server then the server location must point to the localhost and if it is pointing to different location then we must set the location or IP Address.

Server and Database Connectivity

wp-config.php Configuration

In WordPress Configuration file, we must mention the Database Name, Login User Name,  Login Password and Database Host. You can check these things through cPanel Login. Once you logged in to cPanel, you can check the MySQL Databases under Databases as shown in the below Image.

database connectivity

If you click on the MySQL Databases, then you can find the list of databases created in your server. If you are unable to identify the database allocated for your website, then just click on the phpMyAdmin. You will see the list of created database. Expand the individual Database and by clicking of options you can identify the exact database pointing to your website. Once the Database is found, go to MySQL Databases and find the privileged user for the Database. Choose the privileged user and change the password. Once all set, open the wp-config.php file through FTP or through cPanel. Check the Database Name, Username, Password with the things you identified in the above steps.

database details

Please make sure the database is within the server to use the host as localhost or 127.0.0.1 or else the host must point the respective database.

Sometimes after doing all these configuration, you may be requested to start installing WordPress file from beginning. This may be due to Wrong configuration of WordPress Prefix. Make sure the Database prefix is set properly by checking it in PhpMyAdmin. Once things done then the person will full access (Administrator) can login without any issues.

Even after this, if you are not able to see the website loading perfectly then it is due to Theme. Go to Appearance -> theme, change your theme. If the website is loading perfectly, then install the theme again and activate it. This will make sure the website is back like before.

 Fixed – Error in Establishing Database Connection WordPress

Gowdham Subramaniam
Technical Support Manager & Author at SEEKAHOST. Having Experience in Handling Various Web Hosting Servers. Expert in solving the Issues related to Servers, Websites, Malware Issues and more.
Gowdham Subramaniam

Leave a Reply

Your email address will not be published. Required fields are marked *