Error establishing a database connection


08 July 2018 | Admin | Share :      


Error establishing a database connection

An error display when opening a website frequently occurs, sometimes the error message that appears is "Error establishing a database connection". Keep in mind, if the message appears to mean that the web Developer is creating a website using CMS Wordpress. Usually the message appears because our website is not connected aka a disconnect the connection with the database. The basic causes are:

  1. An error occurred on the hosting server so it could not connect to the database.
  2. Can also data access to the database is changed, for example password, user login or databases.

For the first case, we should immediately report to our hosting provider to promptly repair the database connection. For the second case, we should check the login data. The way, open the Wp-config. php file, see DB_NAME, DB_USER, DB_PASSWORD, whether it corresponds to the settings in CPANEL, if it is not appropriate then adjust immediately, hopefully can solve the problem.

Well, next up is we have to find another cause to disconnect the connection with the database, hopefully in the future the connection is not disconnected anymore.


Disabling Pingback and Trackback


The case that I experienced was already 2 times in 1 day my web encountered a database connection error. After being analyzed, the cause was pingback. Then Pingback and trackback should be disabled. How:


1. Disable Pingback and trackback in the admin panel

Login in the admin panel, click the Settings > Discussion menu.
Uncheck the text:

-Attempt to notify any blogs linked to from the article
-Allow link notifications from other blogs (pingbacks and trackbacks)

2. Disable the X-Pingback Header in the functions. php file, add the following script:


function Remove_x_pingback ($headers) {
unset ($headers [' X-Pingback ']);
return $headers;
}

add_filter('wp_headers', 'remove_x_pingback');


3. Preventing Denial of Service attacks in the. htaccess file, add the following script:


Order Deny, Allow
Deny from all

The script function above is to reject all access to xmlrpc. php file

Positive effects of Pingback and trackback: After we disable Pingback and trackbacks, it will impact the SEO of our web, but do not have to be kwatir, we should see if more positive or negative effects. Improving SEO can be in a variety of ways, for example many quality backlinks, improve content quality, age domain, good website structure, Web Templates should also be neat and clean, etc...

Negative effects of Pingback and trackback: Increased risk of security attacks on websites. The hackers can launch DDos (Distributed Denial of Service) attacks and consequently is access to the web becomes slow and can not even be accessed at all.

Note: the image  "error establishing a database connection" above is implemented using WordPress cms on localhost xampp

Comments Blog