Bench update i get this - pymysql.err.OperationalError: (1045, u"Access denied for user

pymysql.err.OperationalError: (1045, u"Access denied for user ‘6ee4650b6fc86cc4’@‘localhost’ (using password: YES)")
on Bench update i get this err can anyone help me

1 Like

i have reset my passwd in site_config.json but i get same err access denied any other way

i set the paswd as root in db password.

Traceback (most recent call last):
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/middlewares.py”, line 15, in call
return super(StaticDataMiddleware, self).call(environ, start_response)
File “/home/ubuntu/frappe-bench/env/lib/python2.7/site-packages/werkzeug/wsgi.py”, line 766, in call
return self.app(environ, start_response)
File “/home/ubuntu/frappe-bench/env/lib/python2.7/site-packages/werkzeug/wsgi.py”, line 766, in call
return self.app(environ, start_response)
File “/home/ubuntu/frappe-bench/env/lib/python2.7/site-packages/werkzeug/local.py”, line 228, in application
return ClosingIterator(app(environ, start_response), self.cleanup)
File “/home/ubuntu/frappe-bench/env/lib/python2.7/site-packages/werkzeug/wrappers.py”, line 308, in application
resp = f(*args[:-2] + (request,))
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/app.py”, line 88, in application
response = handle_exception(e)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/app.py”, line 191, in handle_exception
http_status_code=http_status_code)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/website/render.py”, line 28, in render
path = resolve_path(path.strip(’/ '))
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/website/render.py”, line 207, in resolve_path
path = resolve_from_map(path)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/website/render.py”, line 213, in resolve_from_map
for r in get_website_rules()])
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/website/render.py”, line 238, in get_website_rules
return frappe.cache().get_value(‘website_route_rules’, _get)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 72, in get_value
val = generator()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/website/render.py”, line 231, in _get
rules = frappe.get_hooks(“website_route_rules”)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py”, line 832, in get_hooks
hooks = _dict(cache().get_value(“app_hooks”, load_app_hooks))
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 72, in get_value
val = generator()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py”, line 810, in load_app_hooks
for app in [app_name] if app_name else get_installed_apps(sort=True):
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py”, line 774, in get_installed_apps
installed = json.loads(db.get_global(“installed_apps”) or “[]”)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/database.py”, line 723, in get_global
return self.get_default(key, user)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/database.py”, line 735, in get_default
d = self.get_defaults(key, parent)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/database.py”, line 741, in get_defaults
defaults = frappe.defaults.get_defaults(parent)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/defaults.py”, line 57, in get_defaults
globald = get_defaults_for()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/defaults.py”, line 177, in get_defaults_for
where parent = %s order by creation""", (parent,), as_dict=1)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/database.py”, line 136, in sql
self.connect()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/database.py”, line 86, in connect
charset=‘utf8mb4’, use_unicode = True, conv = conversions)
File “/home/ubuntu/frappe-bench/env/lib/python2.7/site-packages/pymysql/init.py”, line 94, in Connect
return Connection(*args, **kwargs)
File “/home/ubuntu/frappe-bench/env/lib/python2.7/site-packages/pymysql/connections.py”, line 327, in init
self.connect()
File “/home/ubuntu/frappe-bench/env/lib/python2.7/site-packages/pymysql/connections.py”, line 598, in connect
self._request_authentication()
File “/home/ubuntu/frappe-bench/env/lib/python2.7/site-packages/pymysql/connections.py”, line 862, in _request_authentication
auth_packet = self._process_auth(plugin_name, auth_packet)
File “/home/ubuntu/frappe-bench/env/lib/python2.7/site-packages/pymysql/connections.py”, line 933, in _process_auth
pkt = self._read_packet()
File “/home/ubuntu/frappe-bench/env/lib/python2.7/site-packages/pymysql/connections.py”, line 683, in _read_packet
packet.check_error()
File “/home/ubuntu/frappe-bench/env/lib/python2.7/site-packages/pymysql/protocol.py”, line 220, in check_error
err.raise_mysql_exception(self._data)
File “/home/ubuntu/frappe-bench/env/lib/python2.7/site-packages/pymysql/err.py”, line 109, in raise_mysql_exception
raise errorclass(errno, errval)
OperationalError: (1045, u"Access denied for user ‘1bd3e0294da19198’@‘localhost’ (using password: YES)")

Server Error: Please check your server logs or contact tech support. this i get in my UI.

@Jecintha are you able access mysql normally like mysql -uroot -p or bench mysql
if not please check this link Try Bench Restore?

when i try to use bench mysql i get this err
ERROR 1045 (28000): Access denied for user ‘1bd3e0294da19198’@‘localhost’ (using password: YES)
my mariadb status is active. my bench is running but in UI i get that error.
give me idea to clear it.

If you run these, it should hopefully work (You might need to adjust the “site1.local” to whatever you have used instead)

 DBname=$(cat ~/frappe-bench/sites/site1.local/site_config.json | awk '/db_name/ {print $2}' | sed "s/\"//g" | sed "s/,//g")
 DBpass=$(cat ~/frappe-bench/sites/site1.local/site_config.json | awk '/db_password/ {print $2}' | sed "s/\"//g")
 #
 mysql -uroot -pYourMySQLpassword -Bse "GRANT ALL PRIVILEGES ON *.* TO '$DBname'@'localhost' IDENTIFIED BY '$DBpass' WITH GRANT OPTION;"
 mysql -uroot -pYourMySQLpassword -Bse "GRANT ALL PRIVILEGES ON *.* TO '$DBname'@'127.0.0.1' IDENTIFIED BY '$DBpass' WITH GRANT OPTION;"

after your commands i get this msg
ERROR 1133 (28000) at line 1: Can’t find any matching row in the user table

Can you run

DBname=$(cat ~/frappe-bench/sites/site1.local/site_config.json | awk ‘/db_name/ {print $2}’ | sed “s/”//g" | sed “s/,//g”);
DBpass=$(cat ~/frappe-bench/sites/site1.local/site_config.json | awk ‘/db_password/ {print $2}’ | sed “s/”//g");
echo DBname=$DBname;
echo DBpass=$DBpass;
whoami;
pwd;

and show me the output

“db_name”: “1bd3e0294da19198”,
“db_password”: “root”,
my db name are paswd are shown can u find any way

Failed to restart mysql.service: Unit mysql.service not found.
i get this error when i execute this command
sudo service mariadb start

when i get execute this command sudo systemctl status mariadb i get this error systemctl daemon-reload

You can apply below command:

Change Password of the root user in ERPNext:

sudo mysql -u root
MariaDB [(none)]> USE mysql;
MariaDB [(none)]> UPDATE user SET password=PASSWORD(‘YourPasswordHere’) WHERE User=‘root’ AND Host = ‘localhost’;
MariaDB [(none)]> FLUSH PRIVILEGES;

sudo supervisorctl stop all
sudo supervisorctl start all
sudo service mysql restart
bench update --requirements
bench clear-cache

Thanks.