How do I fix "Error establishing a database connection" in WordPress? Print

  • 0

This means WordPress can't reach its database. Check the credentials in wp-config.php first.

  1. In cPanel's File Manager, open wp-config.php and note DB_NAME, DB_USER, DB_PASSWORD and DB_HOST (usually localhost).
  2. In MySQL Databases, confirm the database and user exist and that the user is added to the database with all privileges.
  3. If unsure of the password, reset it in MySQL Databases and update it in wp-config.php.

If credentials are correct, the database may be temporarily overloaded or corrupted, try phpMyAdmin > Repair table, or add define('WP_ALLOW_REPAIR', true); to wp-config.php and visit yourdomain.com/wp-admin/maint/repair.php. Still failing? Open a ticket.


Was this answer helpful?

« Back