Error establishing a database connection or access denied

For hosting customers · Updated 2026-10-29

On this page
  1. Symptoms
  2. Causes
  3. Fix
  4. Still not working?

Symptoms

  • WordPress shows "Error establishing a database connection".
  • An application or log shows SQLSTATE[HY000] [1045] Access denied for user 'username_shop'@'localhost' (using password: YES).
  • Unknown database or #1044 - Access denied for user … to database ….
  • A desktop tool cannot connect from your computer.

Causes

  1. The name is missing the prefix. Databases and users are always called username_something.
  2. The password in the configuration file is wrong (or was changed in the panel).
  3. The user is not added to the database.
  4. The host is not localhost.
  5. From another computer: the address is not allowed in Remote MySQL.
  6. The database was deleted or a table is damaged.

Fix

1. Use the full names

Open MySQL Databases (section Databases). Copy the exact database name from Databases and the user name from Database users into your configuration file (for WordPress, DB_NAME and DB_USER in wp-config.php).

2. Set the password again

Under Database users, click Password next to the user, enter a new password and click Change. Put the same password in the configuration file. See how to change a database password.

3. Add the user to the database

Look under Privileged users next to the database. If the user is not there, use Add user to database → Grant all privileges. See privileges.

4. Use localhost as host

Set the host to localhost (WordPress: DB_HOST). Do not use 127.0.0.1, the server's IP address or the domain for websites on this server. See connection details.

5. Allow your address for remote connections

For a desktop tool or another server, add its public address in Remote MySQL and connect to the server name shown there, port 3306. See Remote MySQL.

6. Check the database itself

Make sure the database still exists in the list. If the error mentions a crashed or damaged table, run Check & repair.

Still not working?

  • Wait a minute after any change: new users, passwords and privileges are applied within seconds, remote addresses within a minute.
  • Open phpMyAdmin from MySQL Databases: if your tables are there, the database is fine and the problem is in the configuration file.
  • Check that the account has disk space left on Resource Usage; a full disk can stop the database from writing.
  • Run Site Check for the website and contact support with its result and the exact error message.
Was this article helpful?

Still stuck?

Ask the AI about your exact situation — it answers from this knowledge base — or contact us.