Cheap Web Space, Domain Name:
Web Space With E-Mail, PHP/MySQL.

Why do I see "Error establishing a database connection" when I open my Wordpress site?

Question: 

Searching …

 

Unfortunately nothing found on "".

Premium support for Bitpalace web hosting customers only!

 from the Federated States of Micronesia: +49 30 32 70 18 92, Fax (in Germany) +49 30 32 70 18 91

service@bitpalast.net 

Skype: bitpalast

One moment please … your browser is loading the page.

 

 

Symptom

I open my Wordpress page in the browser, but only see a white page with the message "Error establishing a database connection".

 

Cause

The database access data (login name, password) entered in your wp-config.php file are incorrect or there is no database with the database name entered there. In very rare cases the entry in the "DB_HOST" field is incorrect.

 

Solution

There are numerous possible solutions. You can either
(a) correct the access data entered in your Wordpress wp-config.php file
(aa) by editing the wp-config.php file with an editor or
(ab) by entering the access data in the Wordpress Toolkit or
(b) reset the database access data so that they correspond to those entered in your wp-config.php file.

It is sufficient to apply one of these solutions.


(a) Retaining the database access data and changing the entries in your wp-config.php file.
You can either edit the wp-config.php file in an editor, e.g. via Plesk file manager, or update the configuration entries in the Wordpress Toolkit.

(aa) By editing the wp-config.php file in an editor:

(aa) 1. Log into the web space control panel.

(aa) 2. Click on the "Websites & Domains" menu.

(aa) 3. Click on the “File manager” icon.

(aa) 4. In a standard Wordpress installation you can already see the top level of your Wordpress installation. If you have installed Wordpress in a subdirectory, first switch to the subdirectory in the file manager in which you installed Wordpress.

(aa) 5. Click on the file name “wp-config.php”.

Why do I see "Error establishing a database connection" when I open my Wordpress site? - Illustration no. 1

The file is opened in the browser for editing. You will see a section similar to this:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'cu-user01_wp_btgyz' );

/** MySQL database username */
define( 'DB_USER', 'cu-user01_wp_8hspw' );

/** MySQL database password */
define( 'DB_PASSWORD', '*2uTAGt1!?LJ0Ka3' );

/** MySQL hostname */
define( 'DB_HOST', 'localhost:3306' );

(aa) 6. Change the values of the variables that follow the variable names "DB_NAME", "DB_USER" and "DB_PASSWORD" to match the access data of your database. The "DB_HOST" field should be preset with "localhost:3306". If this is not the case and your database is located locally in the same web space as the website, change the configuration entry to "localhost:3306".

(aa) 7. Click on the "Save" button.


(ab) By entering new access data in the Wordpress Toolkit
(this assumes that your Wordpress installation was originally linked to the Wordpress Toolkit of the webspace control panel; a link with non-functioning database access data is not possible afterwards.) With this solution you can only enter the username and password of the database user in the Wordpress Toolkit or the wp-config.php file, but you cannot change an incorrect database name:

(ab) 1. Log into the webspace control panel.

(ab) 2. Click on the “Wordpress” menu.

(ab) 3. In the list of your Wordpress websites, look for the Wordpress installation whose database access data you want to change. If you only have a single Wordpress installation, there is only one entry in the list.

(ab) 4. Click on the "Database" tab for the appropriate entry.

(ab) 5. To the right of the line “Database username” you will see a link “[change]”. Click on it.

Why do I see "Error establishing a database connection" when I open my Wordpress site? - Illustration no. 2

(ab) 6. Enter the database username and password of the database user as they apply to the database. Then do not click on the "Generate" button (this would generate a new password randomly), but on the "OK" button.


(b) Retaining the wp-config.php file and changing the database access data in the database administration.
This procedure is not suitable if a database name is entered in the wp-config.php file for that a database is missing.

(b) 1. Log into the webspace control panel.

(b) 2. Click on the "Databases" menu.

(b) 3. In the list of your databases, look for the database whose access data you want to change. If you do not know the database name, look in the configuration entry “DB_NAME” in your wp-config.php file. If there is a name for which you cannot find a database, the entry in the wp-config.php file is incorrect. In this case, use solution (aa) or (ab) (see above) to correct the access data.

(b) 4. For each database you will find an entry "Users:" and to the right of it the username. There can be multiple usernames for a database. Find the username stored in your Wordpress installation. Click the username. The username is named in the configuration entry “DB_USER” of your wp-config.php file. If there is a name for which you cannot find a database user, you can rename the database user in the following step. If there is no user in your database, in the database menu click on "User Management" and there on "Add Database User".

Why do I see "Error establishing a database connection" when I open my Wordpress site? - Illustration no. 3

(b) 5. Fill in the username so that it corresponds to the username specified in your wp-config.php file in the "DB_USER" configuration entry. Enter the password, which is named in the configuration entry “DB_PASSWORD” in the wp-config.php file, into the fields “Password” and “Confirm password”. The access data must match those stored in the wp-config.php file.

Why do I see "Error establishing a database connection" when I open my Wordpress site? - Illustration no. 4

(b) 6. Click the "OK" button.

 

Overview of frequently asked questions 

 

 

 


 

  from the Federated States of Micronesia: +49 30 32 70 18 92 •  GmbH, Sensburger Allee 27, D-14055 Berlin (Germany)
Your purchase is tax-free, because you order from a non-EU country. © 2024  GmbH. All rights reserved. and the logo are registered trademarks of GmbH. For photo credits see imprint.

Imprint Privacy policy Sitemap