mysql.connector.errors.ProgrammingError: 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) in python code example
Example 1: django.db.utils.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: YES)")
You need to make changes in project settings.py.
Provide USER and PASSWORD for your database
If your database isn't mysql change ENGINE
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'myproject',
'USER': 'root',
'PASSWORD': 'rootpassword',
'HOST': 'localhost',
'PORT': '',
}
}
Example 2: Error 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
sudo mysql -u root -p