Part 2 · 2.6
Error establishing a database connection
The message Error establishing a database connection, or on a Dutch-language site Fout bij het maken van een databaseverbinding, means your website cannot reach the database or is not allowed to log in to it. Your files are still there, and usually your database is too.
The causes on our servers, from common to rare
- The details in your website's configuration file are wrong, especially after a move, a new installation or a new password.
- The database user is not (or no longer) linked to the database.
- The database is empty, for example because the import failed after a move.
- Damaged tables.
- Too many connections at once: the error log shows Too many connections or max_user_connections.
- Your package's storage is full.
How to fix it
- In DirectAdmin, open Databases. There you can see the full name of your database and the users linked to it.
- Open the configuration file in File Manager. For WordPress, that is wp-config.php in public_html.
- Compare the four values:
- DB_NAME: the full database name, with your DA username and an underscore in front, such as wtsilefl_shop;
- DB_USER: the full name of the database user, also with that prefix;
- DB_PASSWORD: the password of that database user, not your DA password;
- DB_HOST: localhost.
- Not sure about the password? Give the database user a new password in DirectAdmin and put exactly that password in wp-config.php.
- Check in phpMyAdmin whether the tables are really there. If not, import the database again.
When should you contact us?
Are the details correct, are the tables there and does the message still appear? First check Outages & maintenance, then get in touch.
Ask the AI assistant in My WebOké first, or create a ticket via Support centre and then Submit a ticket. Include:
- the full address of the page where it goes wrong
- the time it went wrong
- what you were doing at that moment, for example saving, uploading or logging in
- a screenshot of the message
Never send your password.
Detailed explanation: 'Error establishing a database connection'.
