If your website shows a “Database Connection Error” or “Could not connect to MySQL” message, it usually means your site’s configuration can’t reach the correct database. This can happen after migrations, incorrect credentials, or MySQL restarts. Follow the steps below to identify and fix the issue.
1. Confirm Database Credentials
Check your site’s configuration file for correct login details:
- WordPress:
wp-config.php - PHP Applications: Usually
config.phpordatabase.php
Make sure the following details match what’s in your cPanel → MySQL® Databases section:
- Database Name:
user_database - Username:
user_dbuser - Password: The one you set for that MySQL user
- Host:
localhost
Even one incorrect character (especially underscores or prefixes) can prevent the connection.
2. Test the Connection in phpMyAdmin
In cPanel → phpMyAdmin → select your database. If it loads successfully, MySQL is online — the issue is your site configuration, not the server.
3. Verify Database User Privileges
- In cPanel → MySQL Databases
- Scroll to “Add User to Database” → select your user and database.
- Check “All Privileges” → click “Make Changes.”
Incorrect or missing privileges are one of the most common causes of connection errors after migrations.
4. Check for Database Name Prefix
cPanel automatically adds a prefix (usually your username) to each database name and user. If your config file doesn’t include that prefix, it will fail to connect. Example: db_name should be user_db_name.
5. Database Overload or Temporary Downtime
Occasionally, your MySQL server may be under heavy load or undergoing maintenance. You can verify system status on our live network page:
https://nodico.net/network.php
If MySQL or shared hosting nodes show as offline, please wait — service will restore automatically.
6. Repair or Optimize Database
- Log in to cPanel → phpMyAdmin.
- Select your database → check all tables → choose Repair Table.
- If errors persist, try Optimize Table next.
7. Error in Website Scripts
If your config details are correct and MySQL is online, the error could be caused by corrupted files or plugins (especially in WordPress). Try temporarily renaming the plugins folder to test if the site loads.
8. When to Contact Support
- phpMyAdmin or cPanel fails to load MySQL at all.
- All sites on your account show database connection errors.
- You suspect data corruption beyond basic repair.
Open a support ticket here:
https://billing.nodico.net/submitticket.php
Note: Nodico assists with MySQL server issues and connection validation. Custom application debugging or third-party CMS database repair is outside our support scope.