Click here to Skip to main content
15,905,414 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I AM TRYING TO CONNECT MYSQL AND PYTHON USING MYSQL.CONNECTOR BUT GETTING THE ERROR: mysql.connector.errors.ProgrammingError: 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

What I have tried:

no help available as per my need
Updated 23-Jun-21 6:34am
Member 15254259 19-Jun-21 23:44pm    
kindly reply soon as i need to resolve it at the earliest for a project
Richard MacCutchan 20-Jun-21 3:33am    
Look at the error message. The user information that you are using is not valid.
Member 15254259 21-Jun-21 13:44pm    
it is valid as the same user information for pymysql.connect and sqlalchemy's create_engine is working properly without any error.

1 solution

Share this answer
Member 15254259 23-Jun-21 12:59pm    
As I mentioned, it is working properly with pymysql and sqlalchemy's create_engine, so ,there isn't any chance of the authentication data provided to be wrong. Furthermore, I have no idea regarding which version would be compatible for me and how to specifically download that version. Moreover, all privileges are granted as I have checked it.
Maciej Los 23-Jun-21 14:25pm    
Take a look here: MySQL :: MySQL Connector/Python Developer Guide :: 3 Connector/Python Versions[^], where you'll find an information what version of Python and Connector is suitable.
Member 15254259 24-Jun-21 6:12am    
my version is compatible according to that page. What should i do now?
Maciej Los 24-Jun-21 6:20am    
I'd check MySql configuration. Maybe MySql server does NOT accept incomming connections.
Member 15254259 25-Jun-21 3:00am    
But,i am able to connect using pymysql with the same statement.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900