1045, Access denied for the user '***'@'localhost'

You can login to the mariadb container by running

$ docker-compose exec mariadb /bin/bash

Once you log into the container, you can launch mysql by running

# mysql -uroot -padmin

This will give access to the database.

1 Like

docker exec -it <mariadb_container_id> bash

refer this topic
pymysql.err.OperationalError - (1045, "Access denied for user 'root'@'localhost' (using password: YES)")

Thanks :slight_smile:

Confirming this worked for me using the helm chart installation. My test installation with the site “localhost” worked, but when I named the site something else I had to do this.

HI, I got the same error,

1045, Access denied for the user ‘***’@’localhost’

In docker. But It was worked yesterday.

Here I don’t want recreate my site or remove volume.
I tried GRANT ALL PRIVILEGES it’s not worked for me.
any other possibility to fix this issue.

1 Like

so anyone did really fix this error … same thing happen to me

I have learned that most of the time the cause of this error: “Access denied for user ‘_<cryptic username>’@<ip address> is being not able to create a new site, particularly if you are using Helm chart to create the site.

So the first thing I would check is the log of the job that creates the new site.

pymysl.err.OperationalError: (1045, “Access denied for user )

CMDs
First open mariadb container.

docker exec -it <mariadb_container_id> bash

you can get id by

docker ps

In MariaDB container:

SELECT User, Host FROM mysql.user;

Drop the user first, like this.

DROP USER '<user>'@'%';

Get the user and password from the file location

/workspace/development/frappe-bench/sites/jk.localhost

In which site_config.json, you can get db_name and db_password
replace it with <db_name> and <db_password>.

CREATE USER '<user>'@'%' IDENTIFIED BY '<db_password>';

GRANT ALL PRIVILEGES ON *.* TO '<user>'@'%' WITH GRANT OPTION;

FLUSH PRIVILEGES;

In frappe docker container:

bench migrate

This issue is resolved for me by doing this in docker container. I hope it helps.

2 Likes

Great Work

Use these steps that will work for the same.

Hi guys,

i’ve setup my testmachine following my flexible script, found here:

Set this inside a file like install_erpnext_docker.sh
Create another file names helpfunctions.sh and put this in:

Put both files in your homefolder, check if your user is in docker group or run as sudo.
Everything should run fine.
Except mariadb-database getting errors like this when running:
2024-02-22 13:37:30 425 [Warning] Access denied for user ‘root’@‘localhost’ (using password: YES)
2024-02-22 13:37:31 426 [Warning] Access denied for user ‘root’@‘localhost’ (using password: YES)
2024-02-22 13:37:32 427 [Warning] Access denied for user ‘root’@‘localhost’ (using password: YES)
2024-02-22 13:37:33 428 [Warning] Access denied for user ‘_a53a701b68798a7d’@‘192.168.160.7’ (using password: YES)
2024-02-22 13:37:33 429 [Warning] Access denied for user ‘_82a5c7b4cab41dd8’@‘192.168.160.7’ (using password: YES)
2024-02-22 13:37:33 430 [Warning] Access denied for user ‘_8c54003cd8c5a3cf’@‘192.168.160.7’ (using password: YES)
2024-02-22 13:37:33 431 [Warning] Access denied for user ‘_f7031d9a8ccbced9’@‘192.168.160.7’ (using password: YES)
2024-02-22 13:37:33 432 [Warning] Access denied for user ‘_ffe0842833b9a6e8’@‘192.168.160.7’ (using password: YES)
2024-02-22 13:37:33 433 [Warning] Access denied for user ‘_01d8f203fe8c80b4’@‘192.168.160.7’ (using password: YES)
2024-02-22 13:37:33 434 [Warning] Access denied for user ‘_b2455b529cec6815’@‘192.168.160.7’ (using password: YES)
2024-02-22 13:37:33 435 [Warning] Access denied for user ‘_b4710f28f1052f47’@‘192.168.160.7’ (using password: YES)
2024-02-22 13:37:33 436 [Warning] Access denied for user ‘_7b8bf4d4878631ed’@‘192.168.160.7’ (using password: YES)
2024-02-22 13:37:33 437 [Warning] Access denied for user ‘root’@‘localhost’ (using password: YES)
2024-02-22 13:37:34 438 [Warning] Access denied for user ‘root’@‘localhost’ (using password: YES)
2024-02-22 13:37:35 439 [Warning] Access denied for user ‘root’@‘localhost’ (using password: YES)

if you open your page, you will get Internal Server Error.

Any Help?
Regards Andreas