Mysql.connector issue

I am trying to connect mysql(8.0) and python(3.8) using mysql.connector but getting the error:

mysql.connector.errors.ProgrammingError: 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES) Windows 10

same code working for pymysql

the code used:
import mysql.connector as sql s=sql.connect(host=‘localhost’,user=‘root’,passwd=‘12345’)

Kindly help me out solve the issue as i am not able to.

I think you may have a typo in the parameters. Maybe try “password” instead of “passwd”. Was comparing to this mysql python example .

Without getting too deep with mysql.connector, the “Access denied” would lead me to think that this is either a credential issue or you are not supposed to use “root”. So maybe the interpreter thinks you are trying to connect without a password because the keyword is different.

I am getting the same output even with ‘password’.

Perhaps you should take a look at the MySQL/Connector docs. If you still need further help, I would repost to the MySQL/Connector/Python forum; you might get more luck there.

I would need further help as I already checked that link ,but, couldn’t solve it out.

Have you posted the question there?

No, it was a figure of speach. I was suggesting that you post the question in the MySQL/Connector/Python forum.