Black Friday Sale 90% OFF
09
DAYS
15
HOURS
19
MINUTES
42
SECONDS

How to fix "Error establishing a database connection"

Modified on:
database wordpress error establishing connection mysql sql

If you ever see the 'Error establishing a database connection' message, this usually means that your website failed to connect to the database due to incorrect database configuration settings. For example, WordPress's database configuration file is wp-config.php, located in your WordPress installation's root (main) folder.

The most common causes are:

- Incorrect MySQL hostname used.
Make sure you are using the correct hostname. Hostinger does not use localhost, make sure you find out your accounts MySQL hostname.

- Incorrect MySQL username / password or database name.
Make sure to check the database name, username and password that your configuration file is using, it has to be identical to the information in your MySQL details page. Try to avoid using any special characters, such as "',~{]{]@", if you are having issues connecting to your database. Try changing your database password if you are unsure if you are using the correct password.

For further troubleshooting of this issue, consider checking out these tutorials:

https://www.hostinger.com/tutorials/wordpress/wordpress-error-establishing-database-connection
https://www.hostinger.com/tutorials/wordpress/how-to-find-out-Wordpress-database-name

  • Unlimited Number of Websites
  • 24/7 Live Support
  • Easy Website Builder
  • 2X WordPress Optimized Speed
  • 30-Days Money-Back Guarantee
Black Friday Sale
From
PHP
35
00
/mo
Save 90%
Get started