[Solved] DK0051 Error: Access denied despite matching passwords in config.json and Docker

Hi everyone,

I wanted to share a solution for the DK0051 error (“Access denied”) that I recently encountered, in case anyone else gets stuck in the same loop.

The Issue:

I was getting the following error when trying to delete a site:

Error - DK0051: DELETE_SITE_DATABASE: Error (1): UERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)

The Confusion:

I checked the password in DevKinsta/config.json and compared it with the MYSQL_ROOT_PASSWORD environment variable in Docker Desktop (docker inspect devkinsta_db). They were identical.

Since the passwords matched, I couldn’t understand why access was being denied.

The Diagnosis:

I decided to access the database container directly to investigate.

  1. I opened the terminal and ran: docker exec -it devkinsta_db bash

  2. I tried logging in without a password: mysql -u root

Surprisingly, I was able to log in without a password, even though the Docker environment variable showed a password was set. It seems the actual database user privileges were out of sync with the Docker configuration.

The Solution:

I manually reset the root password to match what DevKinsta expects (the one found in config.json).

Inside the container (docker exec -it devkinsta_db bash), I ran:

SQL

mysql -u root
-- Once logged in:
FLUSH PRIVILEGES;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'YOUR_PASSWORD_FROM_CONFIG_JSON';
exit

(Make sure to replace YOUR_PASSWORD_FROM_CONFIG_JSON with your actual password found in the config file).

After doing this, DevKinsta was able to connect and the error was resolved.

Hope this helps!

1 Like