I am trying to connect MySQL(8.0.25) and python(3.9.6) using mysql.connector but getting error.
The password I entered is the one I use to successfully login to MySQL 8.0 Command line client.
Same code is working for pymysql.connect without any error.
I checked out the Host and User Name by logging in to MYSQL 8.0 Command Line client with my password and typing:
And got the Output:
Kindly help me out as I tried everything but couldn't solve it.
Looking forward for a reply.
Error:mysql.connector.errors.ProgrammingError: 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Code:1 2 |
import mysql.connector as sql s = sql.connect(host = 'localhost' ,user = 'root' , password = '<correct password>' ,database = 'empl' ) |
Same code is working for pymysql.connect without any error.
I checked out the Host and User Name by logging in to MYSQL 8.0 Command Line client with my password and typing:
1 |
mysql>Select current_user; |
Output:+----------------+
| current_user |
+----------------+
| root@localhost |
+----------------+
Thanks in advance.Kindly help me out as I tried everything but couldn't solve it.
Looking forward for a reply.
Larz60+ write Jul-11-2021, 06:13 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Please refrain from using images for code.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Please refrain from using images for code.