Help center · Syndaq

MySQL database connection error in a cPanel-hosted site

Fix failed database connections in PHP applications and CMS installs.

A database connection error usually means the application has the wrong database name, username, password, or host, or the database user does not have privileges on the target database.

Common symptoms

  • Error establishing a database connection
  • Access denied for user
  • The site fails after a password or migration change

Troubleshooting steps

  1. Open cPanel and confirm the exact database name and database user, including any required account prefixes.
  2. Reset the database user's password and update the same value inside the application's configuration file.
  3. Ensure the user is assigned to the database with the required privileges.
  4. Verify the application is using the correct database host. Many shared hosting environments expect localhost.
  5. If the database was imported recently, confirm it contains the expected tables and was not imported into a similarly named database by mistake.

Additional notes

  • cPanel prefixes database names and usernames automatically on many hosting plans.
  • A successful import does not grant permissions automatically; the database user still must be assigned.

When to contact support

Contact support if the credentials are correct and the database is present but the application still cannot connect.

Back to help center