Fix «Error establishing a database connection»
This appears when the database has stopped, the connection details in wp-config.php are wrong, or tables are damaged. Check in this order: repair, connection details, backup restore.
ChemiCloudcPanelDatabasesphpMyAdmin
HostingerhPanelDatabasesphpMyAdmin
Steps
- Fix it with phpMyAdmin, or add the line below to
wp-config.php.define('WP_ALLOW_REPAIR', true); - Open yourdomain.com/wp-admin/maint/repair.php and click Repair Database. When it finishes, delete the line you added.
- Check that
DB_NAME,DB_USER, andDB_PASSWORDin wp-config.php match your real database. Always check this after moving servers. - If it still doesn't work, restore a backup.
Source
Related posts
- WordPress error fixesWordPress 500 error (Internal Server Error) fixA 500 error means the server could not process the request. Check in this order: rename .htaccess, raise the PHP memory limit, turn off plugins, reinstall WordPress.4 stepscPanel › Files › File Manager › public_htmlRead
- WordPress error fixesFix the WordPress white screen (White Screen of Death)If the screen goes blank or shows a critical error message, first check other sites on the same server, then check memory, plugins, cache, and debug mode in that order.6 stepscPanel › Files › File Manager › wp-config.phpRead
- WordPress error fixesFix ERR_TOO_MANY_REDIRECTS (too many redirects)This happens when the WordPress address and the site address differ. In Settings > General, set both to the same domain.3 stepswp-admin › Settings › GeneralRead