[Python] mysql.connector.errors.ProgrammingError: 1045 (28000): Access denied for user...

Discussão em 'Python' iniciado por Stack, Fevereiro 26, 2025.

  1. Stack

    Stack Membro Participativo

    I am following along with lecturer's code and videos. He has this set up, and I have followed exactly. His works, mine doesn't and I cant figure out why. It is set up as user "root" and password is blank. I have tried pip install mysql-connector-python. I want to keep the same user and password as his so as to follow along better. I am using python and mysql via Wampserver64. When I try to run the python file through cmd I get the error "mysql.connector.errors.ProgrammingError: 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)". I am new to this so trying to figure it out as I go along. Does the (using password: YES) mean that the passwords match? And how to I get script to connect to mysql?



    db = mysql.connector.connect(
    host = "localhost",
    user= "root",
    password = " "
    #database ='datarepresentation'
    )
    #print ("connection made")

    cursor = db.cursor()

    cursor.execute("CREATE DATABASE datarepresentation")

    Continue reading...

Compartilhe esta Página