ERPnext + Digitalocean "Access denied for user 'root'@'localhost' (using password: YES)")

Hello,

I have installed ERPnext on Digital Ocean through the one-click installation.
As I use the command to change the password of the database “Access denied for user ‘root’@‘localhost’ (using password: YES)”), this error pops up. I tried accessing it through root as well as a user but faced the same error everytime.
Kindly Help.

Leaving bench aside for the moment, are you able to log in to your database either as root or as the user specified in sites/SITE_NAME/site_config.json? Is the password there correct?

yes i was able to login to mysql database using mysql -u root -p.

Does the login/password combination you used match what’s listed in sites/SITE_NAME/site_config.json?

please change the mysql password and try it.

Try running this (tune the MySQLpwd to your setting/preference)

MySQLusr="root"; MySQLpwd="YourMySQLpassword";
#echo $MySQLusr $MySQLpwd #4DBG#
commandToRun="GRANT ALL PRIVILEGES ON *.* TO \"$MySQLusr\"@\"localhost\" IDENTIFIED BY \"$MySQLpwd\" WITH GRANT OPTION";
mysql -u$MySQLusr -p$MySQLpwd -Bse "$commandToRun";