0
votes

MySQLdb._exceptions.OperationalError: (1045, "Access denied for user 'host'@'localhost' (using password: YES)")

i have the correct password but after trying to connect my app with sql i get this error

 cur = mysql.connection.cursor()
 cur.execute("INSERT INTO user VALUES(%s)",('M'))
 mysql.connection.commit()

From the responses online i should reset my password. I tried it like this: and after i try to reset it with :

1.) cd /usr/local/mysql/bin

2.) ./mysql -u root -p 3.) i type in my password

now no error

Server version: 8.0.12 MySQL Community Server - GPL Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Only in the app I am trying to do.

1
how are you declaring your connection?, Have you confirmed the username and user privileges?sunny chidi

1 Answers

0
votes

It seems that you're trying to connect with username host, hence the Access denied for user 'host'@'localhost' error message.

With the command line you connect with the root user. Can you confirm you're using the correct username in your application?