Access denied for user ***@localhost

getting this error when trying to install ERPNExt on a newly created site after I have downloaded the ERPNext installation files. Kindly help.

pymysql.err.OperationalError: (1045, u"Access denied for user ‘6d4b9452aef14153’@‘localhost’ (using password: YES)")

#IF this happens.... (names have been changed to protect the innocent, but you get the idea)
#
#ERROR 1045 (28000): Access denied for user '_1bd3e0294da19198'@'localhost' (using password: YES)
#do this....
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;"
#
mysql -uroot -pYourMYSQLpassword -Bse "set password for '$DBname'@'localhost' = password('$DBpass');"
mysql -uroot -pYourMYSQLpassword -Bse "set password for '$DBname'@'127.0.0.1' = password('$DBpass');"
#delete the DB and re-run
bench new-site site1.local
1 Like

Thank you,

like which command should I begin with?