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

@gavindsouza Thanks for your reply,
When I run bench --site site1.local --force, it shows
Usage: bench frappe [OPTIONS] COMMAND [ARGS]…
Try “bench frappe --help” for help.

Error: Missing command.
When I run this bench frappe --help, it shows 'frappe not installed". But Frappe is already installed.

Thank you @arokia and @gavindsouza
Now getting this new error,

I mis’typed, my bad. it’s bench new-site site1.local --force you can also append --install-app erpnext to that since you want that installed.

If you’re having a hard time getting this setup manually, perhaps you should checkout Frappe Docker or the Easy Install Script to get started. Also, start by using stable branches currently like version-12 or version-13-beta instead of develop

Getting similar error on my end using docker . Tried a lot workarounds and fixes.

Things that i tried are

  1. Removing all volumes, network drives and bind volumes, so i can start from fresh
  2. Trying to manually allow a user (which i am guessing is one of the erpnext workers) GRANT ALL ON . TO ‘_c56bfbb8e06ec5a8’@‘172.28.0.6’ IDENTIFIED BY ‘admin’
  3. Adding MYSQL_ROOT_HOST=% to .env and even downgrading maraidb to 10.1 based on some post.

This issue is getting really frustrating to resolve. Any pointers to look anywhere else is really appreciated.

Some insight on the error
2021-11-01 6:50:47 162 [Warning] Access denied for user ‘_c56bfbb8e06ec5a8’@‘172.25.0.9’ (using password: YES)
2021-11-01 6:51:47 163 [Warning] Access denied for user ‘_c56bfbb8e06ec5a8’@‘172.25.0.9’ (using password: YES)
2021-11-01 6:52:36 165 [Warning] Access denied for user ‘_c56bfbb8e06ec5a8’@‘172.25.0.7’ (using password: YES)

Using the env-local as the environment and the default docker-compose.yml file in the repo.

Regards,

Have you found any solution? I am frustrated because of exactly the same error.

1 Like

Run these below commands and then create site

GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ IDENTIFIED BY ‘your_password’ WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON . TO ‘root’@‘localhost’ IDENTIFIED BY ‘your_password’ WITH GRANT OPTION;

it solved the same issue at our end.

That was funny, actually I had to do nothing to solve the issue ^^". I just had to wait for a few minutes, then I was able to view the software in the browser.

After search for hours I found the solution (v13.0.0) as follows:
login into mariadb container and run the command:
grant all privileges on . to ‘_c464f00e8a74ba61’@‘%’ identified by ‘asQSRQEDcujBpllh’; FLUSH PRIVILEGES;

Note that, the db-name: _c464f00e8a74ba61 and user password: asQSRQEDcujBpllh comes from site-config.yml file from erpnext-python container’s sitename.

Hi, how can I login into the mariadb container? I tried to use ‘docker exec’ to enter the container and execute the command but it gave the error “bash: grant: command not found”.

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