MYSQL.CONNECTOR ISSUE WHILE CONNECTING MYSQL AND PYTHON

I am trying to connect MySQL(8.0.25) 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.connect

the code used:

import mysql.connector as sql
s=sql.connect(host='localhost' ,user='root', password='<correct password>)
The password I entered is the one I use to successfully login to MySQL command line client.
Didn't get any real help in Google. Looking forward for Help. Thanks in advance.