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

Hi,
I’m a student and I started learning ERPNext software. I followed Easy Install Script for installing frappe + bench + ERPNext for development and it successfully installed on Ubuntu 18.04.
While executing bench start command and using http://0.0.0.0:8000/ in my browser, it shows the following error,
pymysql.err.OperationalError: (1045, “Access denied for user ‘_1bd3e0294da19198’@‘localhost’ (using password: YES)”)

Can you please provide a solution and guide me for using ERPNext for development.
Thank you!

@Ananth try bench mariadb and share the output.
mariadb version?

Thanks for your reply @arokia

mariadb version,
Your MariaDB connection id is 64
Server version: 10.2.32-MariaDB-1:10.2.32+maria~bionic-log mariadb.org binary distribution

while trying bench mariadb , it shows same 1045 error.

run sudo mysql_secure_installation

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
FLUSH PRIVILEGES;
USE mysql;
USER ‘root’@‘localhost’ IDENTIFIED BY ‘N3w_p@ssw0rD.’;
quit
sudo systemctl start mysql

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

@arokia
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’@‘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”.