見出し画像

[troubleshooting] ProgrammingError: 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) mysql-connector of python.

I occered this trouble when used mysql-connector of python.

but I could solve it. so I inturoduce how to solve the trouble shoot.

Type of Error

import mysql.connector

mydb = mysql.connector.connect(
  host="localhost",
  user="root",
  password="yourpassword"
)

print(mydb)

after excute…

ProgrammingError: **** (*****): Access denied for user 'root'@'localhost' (using password: YES)

solve trouble short

but this program is (using password: YES).
Why can't i solve?

I thought that this error is indicating already "The passwords match."
so,description of the password is unwanted in mydb=mysql.connector.connect( ) .

change the program

import mysql.connector

mydb = mysql.connector.connect(
  host="localhost",
  user="root",
 #remove this line or password="" 
)

print(mydb)

It's remove the line of the password. if you want to insert the line of the password,it's unwanted the spase(for instance,password="", this isn't password=" ").

OK!

(annotation!)
olse,to change the mysql setting from Translate(PowerShell) is unwanted.
I took many time to validate… Its action didn't means.

end

my Twitter

この記事が気に入ったらサポートをしてみませんか?