How to Solve Error Message Error establishing a database connection in WordPress Installation

Posted on

Introduction

The article has a specific subject in the term of content. The subject is in the material about how to solve an error in the wordpress installation step. In the installation process, sometime there will be an error with the error message of ‘Error establishing a database connection’. The wordpress installation step consists of several step of sequence. The error message appear in the installation step which is in the database configuration connection. The output message is available in the following image :

It is a page with a specific error message. The page appear after the submission of the following page :

The above output is a page of a wordpress installation step. That page is a page for setting the wordpress in order to be able to connect to MySQL database server. Actually, all of the value exist in the MySQL database configuration connection has been tested using a specific command in the command line interface for a connection attempt. The attempt for connecting to MySQL database server is a success as it shows in the output of the command line as the following command execution :

root@hostname ~# mysql -uroot -p dbwordpress
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.27-0ubuntu0.18.04.1 (Ubuntu)

Copyright (c) 2000, 2019, 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> 

Solution to the Problem

Apparently, as in the previous section, although the MySQL database connection in the command line is a success, it does not display the same output result. It is not doing quite well with the WordPress installation. Actually, the solution for the above problem is quite simple. Just change the entry of the ‘Database Host’ from ‘localhost’ to ‘127.0.0.1’, the problem will disappear. The following is the image of implementing the solution by changing the entry of ‘Database Host’ from the value of ‘localhost’ into the value of ‘127.0.0.1’ :

After changing the value of the entry of ‘Database Host’ from ‘localhost’ into ‘127.0.0.1’, just click the Submit button. The output will be a success and it will direct the page into the next step of the wordpress installation :

As the above page appear, the problem is actually solved. Finally, the wordpress installation can go on and continue on further. Just click the button with the text label of ‘Run the installation’.

Leave a Reply