“Error Establishing a Database Connection” error indicates that WordPress is unable to establish a connection with the database. Generally, there are a few reasons why this error might appear:
The database server is offline
The database username is incorrect
The database name is incorrect
The database host is incorrect
The database is corrupted
Checking the Database Credentials
In the wp-config.php file, you will find the following lines:
// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define( 'DB_NAME', 'database_name_here' ); define( 'DB_USER', 'username_here' ); /** MySQL database password */ define( 'DB_PASSWORD', 'password_here' ); /** MySQL hostname */ define( 'DB_HOST', 'localhost' );
For VeeroTech Systems hosting plans, the “DB_HOST” value will always be “localhost.”
The database connection details must always follow the format shown above and must match your MySQL database and username information found within your cPanel.
By ensuring that the information in the wp-config.php file is accurate and matches the details in your cPanel, you can help prevent the “Error Establishing a Database Connection” from appearing on your WordPress site.
Using cPanel to Inspect the Database for Corruption
Follow these steps to check for database corruption using cPanel:
- Navigate to the “Databases” section of your cPanel account.
- To access the database management tool, click the “phpMyAdmin” button.
- Select the database associated with your WordPress site on the left side of the phpMyAdmin interface.
- After you’ve chosen the database, you’ll see a list of tables on the right. To select all tables, click the “Check All” checkbox at the bottom of the table list.
- At the bottom of the table list, look for the drop-down menu labelled “With selected.” Select the “Check table” option by clicking on it. The selected tables will then be examined for signs of corruption or errors by PhpMyAdmin.
- If any problems are found, you can try to repair the problematic table(s) by checking the box next to the affected table(s), selecting the “Repair table” option from the “With selected” drop-down menu, and letting phpMyAdmin handle the repair process.
You can address potential corruption issues that may be causing the “Error Establishing a Database Connection” on your WordPress site by inspecting and repairing your database with cPanel and phpMyAdmin.
If you have any web hosting questions please feel free to reach out to us. We're happy to help.
Shared Hosting | Reseller Hosting | Managed WordPress Hosting | Fully Managed VPS Hosting
Our Guiding Principles
- Provide consistent, stable, and reliable web hosting services.
- Ensure rapid ticket response and quick resolutions to issues.
- Never saturate or over-provision servers to ensure stability and speed for our customers.
- Use only high-quality enterprise-class hardware to ensure minimal downtime from hardware failures.
- Provide clear pricing with no hidden fees or gotchas.