When your WordPress site displays this error, it means the PHP code is unable to link up with the MySQL database where your posts, pages, and settings are stored. On the mybox infrastructure, this is almost always due to a mismatch in the login credentials stored in your configuration file.
This typically happens after a database password has been reset in the dashboard or if the wp-config.php file was edited incorrectly.
Table of Contents
Locating your Database Credentials
To fix the connection, you must compare the data in your website’s configuration file with the actual settings in your mybox panel.
- Connect to your server via FTP or SFTP.
- Navigate to your website’s root directory (usually
public_html). - Open the
wp-config.phpfile and look for these three lines:
PHP
define('DB_NAME', 'database_name'); // The name of the database
define('DB_USER', 'database_user'); // Your MySQL username
define('DB_PASSWORD', 'your_password'); // Your MySQL password
How to Reset and Sync the Password
If you are unsure what the correct password is, the most reliable fix is to set a new one in the mybox panel and then update the file.
1. Set a new password in the panel
- Log in to your mybox dashboard and go to Databases > MySQL Users.
- Find the user listed in your
wp-config.phpfile (theDB_USERvalue). - Click Change password.
- Enter a new password or use the generator, then save the changes.
2. Update the configuration file
- Go back to your
wp-config.phpfile in your text editor. - Replace the old value in
DB_PASSWORDwith the exact password you just created in the panel. - Save the file and upload it back to the server.
Distinction Block
Database User vs. Panel User Your mybox panel login is different from your MySQL User login. WordPress needs the specific MySQL credentials found in the “Databases” section to access your site data.
Practical Implications
- White Screen vs. Error Message: If you see a completely blank screen instead of the database error message, you may also need to enable
WP_DEBUGto see if there are additional PHP errors. - Database Host: In the
wp-config.phpfile, there is also aDB_HOSTline. On the mybox infrastructure, this is usually set tolocalhost. Do not change this unless specifically instructed by support. - Table Prefix: If you have recently migrated your site and the connection is successful but the site looks “empty,” check the
$table_prefixline inwp-config.php. It must match the prefix used by the tables in your database (e.g.,wp_).
Summary
The “Error Establishing a Database Connection” is a simple “wrong key” problem. By verifying the database name, username, and password in your mybox panel and ensuring they match your wp-config.php file exactly, you can restore your website to full functionality.