D.B. Posted June 22, 2021 Share Posted June 22, 2021 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 The code is: import mysql.connector con=mysql.connector.connect(host='localhost',user='root',passwd='12345',database='empl') same code properly working with pymysql.connect and sqlalchemy's create_engine. kindly see the image attached kindly reply soon as i need to complete it for a project urgently. Link to comment Share on other sites More sharing options...
D.B. Posted June 25, 2021 Author Share Posted June 25, 2021 No reply received since a long time. 1 Link to comment Share on other sites More sharing options...
lakshitha Posted July 1, 2021 Share Posted July 1, 2021 Did you put a password for root account? Otherwise don't use any password for access. Link to comment Share on other sites More sharing options...
D.B. Posted July 8, 2021 Author Share Posted July 8, 2021 (edited) Yes, I log in to MYSQL COMMAND LINE CLIENT using that password. After that ,I typed 'select current_user;' and got the output: +----------------+ | current_user | +----------------+ | root@localhost | +----------------+ which means the password I use to login is of root account and host is localhost. Edited July 8, 2021 by D.B. Link to comment Share on other sites More sharing options...
D.B. Posted July 13, 2021 Author Share Posted July 13, 2021 Waiting for a Reply. 1 Link to comment Share on other sites More sharing options...
lakshitha Posted July 14, 2021 Share Posted July 14, 2021 Try to connect again adding "port" argument like this, conn2 = mysql.connector.connect(host="localhost", user="root", passwd="12345", database="empl", port="#PORT") Otherwise, Go to localhost sever using browser and make sure about that password is correct. Or make a new account (with password or without) and try to execute your queries via command line with database. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now