add-circle-bold add-circle add-square add alarm-bell-1 alert-diamond analytics-pie-2 archive archive arrow-down-1 arrow-down-2 arrow-left-1 arrow-right-1 arrow-up-1 attachment-1 bin-paper-1 book-star button-record check-1 check-circle-1 close close-quote close cog-1 cog common-file-stack copy-paste credit-card-1 diagram-fall-down disable time-clock-midnight download-thick-bottom drawer-send envelope-letter envelope-letter expand-6 expand-6 file-code filter-1 floppy-disk flying-insect-honey folder-file-1 headphones-customer-support hierarchy-9 hyperlink-2 information-circle keyboard-arrow-down keyboard-arrow-up layout-module-1 list-bullets lock-2 lock-unlock-1 love-it messages-bubble-square move-to-top multiple-circle multiple-neutral-1 multiple-users-1 navigation-menu-horizontal navigation-menu network-browser open-quote pencil-1 pencil-write pencil-1 print-text rating-star rating-star remove-circle remove-square-1 search send-email-1 shield-warning single-neutral-actions single-neutral smiley-sad-1 smiley-unhappy smiley-indifferent smiley-smile-1_1 smiley-happy smiley-sad-1 smiley-unhappy smiley-indifferent smiley-happy smiley-thrilled social-media-twitter synchronize-arrows-1 tags-double ticket-1 ticket-1 time-clock-circle undo view-1 view-off view wench

WordPress Error Establishing a Database Connection

This error occurs when WordPress is having trouble connecting to your site’s MySQL database server. Your database is where all your files live. If WordPress can’t connect to it, your site is most likely going to be down.

The Solution:

Check if wp-config.php checks out

The wp-config.php file contains your login credentials and other essential details about WordPress.

Make sure your username, password, database name, and host server is correct. To do so, hop on over to your root directory and locate the wp-config.php, access it, and make sure this code has your correct credentials in it.

define('DB_NAME', 'database_name');
/** MySQL database username */
define('DB_USER', 'username');/** MySQL database password */
define('DB_PASSWORD', 'password');

/** MySQL hostname */
define('DB_HOST', 'localhost');

Doing this resolves the issue in most cases.

Reach out to your host for help

If the error persists, it’s possible that something have gone south with your MySQL servers or you might have reached their maximum size. In either case, it might be time to contact your web host and ask for a quick fix.