Issue connecting MySQL to Django

  Kiến thức lập trình

My Django project will not migrate the changes I have made to the settings.py I get this error (1045, “Access denied for user ‘root’@’localhost’ (using password: NO)”)

I installed and setup a MySQL created a database connected all the information to my settings.py quadruple-checked to ensure they were correct. I have tried refreshing the server, granting all privileges to localhost, changing localhost to 127.0.0.1, and ran “ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘mypassword’;
FLUSH PRIVILEGES;”.
I am open to any ideas.
Django version: 5.0.4
MySQL version: 8.4

DATABASES = {
    "default": { 
        "ENGINE": "django.db.backends.mysql",
        "NAME": "aquadexdb",
        "USER": "root",
        "Password":os.environ.get("MySqlPassword"), #tried the raw password as well
        "HOST": "localhost",
        "PORT": "3306", 
    }
}

New contributor

Shaun is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT