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

Thanks again, @arokia
After executing sudo mysql_secure_installation, then I run bench start,
facing same error

sudo systemctl stop mysql
sudo mkdir –p /var/run/mysqld
sudo chown mysql:mysql /var/run/mysqld
sudo mysql –u root
USE mysql;
USER ‘root’@‘localhost’ IDENTIFIED BY ‘N3w_p@ssw0rD.’;
sudo systemctl start mysql

@Ananth try the above steps so that you can update the mariadb password.

while executing the command sudo mysql -u root
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

Check status of mariadb and Run sudo systemctl start mariadb

Status of mariadb, Itself shows access denied,

try mysql -u root -p

@Ananth first check if you can authenticate using the MariaDB password in the passwords.txt file in your home directory. If you can, you don’t have to try changing your MariaDB root password again.

It’s likely that there’s an issue with your site database; specifically, the error says that the site name and password in the site_config don’t work for you. You can run bench --site site1.local --force to recreate your site.

@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’@‘’ 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’@‘’ (using password: YES)
2021-11-01 6:51:47 163 [Warning] Access denied for user ‘_c56bfbb8e06ec5a8’@‘’ (using password: YES)
2021-11-01 6:52:36 165 [Warning] Access denied for user ‘_c56bfbb8e06ec5a8’@‘’ (using password: YES)

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


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

1 Like

Run these below commands and then create site


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.