Blog

WordPress: Error creating database connection

Afbeelding WordPress: Error creating database connection

The WordPress error message “error when making a database connection” is annoying, but fortunately we also have the solution for that. The error message occurs because your website can no longer reach the WordPress database. The cause is a change in the database data, a corrupted database, or the inaccessibility of your database server. All these causes each have their own solutions.

Why do I get a WordPress database error?

The first question, of course, is why you get this error message. This database error can occur for various reasons, but in all cases your WordPress database can no longer be reached. This may be because the database information has changed, the database is corrupted, or the database server is unreachable. It is also possible that there are problems with your hosting provider. In that case, you can do nothing but wait until the hosting party has solved the problems itself.

How can I fix the problem?

The different causes can be solved in different ways. First of all, we recommend that you contact your hosting provider in case of database problems. In most cases, they can solve the problem for you, and otherwise they can at least advise you. If you still want to get started with this yourself, first make a backup. If something goes wrong, you can always go back to the previous version.

Change in database data

There may have been changes to the database data by yourself, or by your hosting provider. It may happen that the ‘wp-config.php‘ file has not been updated properly by the system. Therefore, initially check the database credentials in the ‘wp-config.php‘ file. This can be done via FTP or via the file manager of the hosting provider. Review the following information:

1.DB_NAME: the name of the database
2.DB_USER: the database username
3.DB_PASSWORD: the database password
4.DB_HOST: host the database

WordPress cannot reach the database if one of these data is incorrect. Then adjust the data and save the file as ‘wp-config.php‘ and refresh your WordPress page.

Corruption in the WordPress database

A WordPress database can be damaged by various causes, such as a database that is too large or a hack. Try to repair the database by logging in with FTP or via the filemanager. Open the ‘wp-config.php‘ file and add the following code:

(‘WP_ALLOW_REPAIR’, true);

Now copy the following url: /wp-admin/maint/repair.php after your domain name and click on the button ”Repair and optimize database”. Then remove the code you just added from the ‘wp-config.php‘.

Unreachable database server

WordPress cannot connect to the database if the database server is no longer reachable. This may be due to updates or technical problems with the hosting provider. As indicated earlier, you cannot repair anything yourself and so you will have to wait until they have solved the problems. If these problems occur more often with your hosting provider, then it is worth considering switching to another party. Of course, it can happen once, but the more often your WordPress website is down, the more money it will cost you.

Contact us

Although the error in the database connection can be fixed, you first need to know what is causing the error. This process is not for everyone. In that case, make sure you ask for help! We can be reached via live chat or by phone. Call us on 030 20 72 488 and we will look for the solution to turn your WordPress problems into WordPress solutions as soon as possible.

Also check out these interesting blog articles:

Was this article helpful?

Yes No

We'll assist you promptly and professionally!

Check here all benefits.

© WPmaintenance.com 2011 - 2024 | All rights reserved | WordPress Maintenance is part of Artitex