[SOLVED] django mariadb connection error : 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
by shams from LinuxQuestions.org on (#5M5SF)
When i run the django server it runs succesfully:
Code:# python manage.py runserver 192.168.1.100:8083
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
July 14, 2021 - 09:01:40
Django version 3.2.5, using settings 'CSCdropdown.settings'
Starting development server at http://192.168.1.100:8083/
Quit the server with CONTROL-C.now when open the http://192.168.1.100:8083/ in firefox get the error:
Code:ProgrammingError at /
1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Request Method: GET
Request URL: http://192.168.1.100:8083/
Django Version: 3.2.5
Exception Type: ProgrammingError
Exception Value:
1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Exception Location: /usr/lib/python3.9/site-packages/mysql/connector/connection.py, line 276, in _auth_switch_request
Python Executable: /usr/bin/pythonThis is settings.py for mariadb database connection:
Code:DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'test',
'USER': 'root',
'PASSWORD': '12345',
'HOST': 'localhost',
'PORT': '8083',
}
}I also gave the 'root'@'localhost' gran access to all mariadb databases.
Code:# python manage.py runserver 192.168.1.100:8083
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
July 14, 2021 - 09:01:40
Django version 3.2.5, using settings 'CSCdropdown.settings'
Starting development server at http://192.168.1.100:8083/
Quit the server with CONTROL-C.now when open the http://192.168.1.100:8083/ in firefox get the error:
Code:ProgrammingError at /
1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Request Method: GET
Request URL: http://192.168.1.100:8083/
Django Version: 3.2.5
Exception Type: ProgrammingError
Exception Value:
1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Exception Location: /usr/lib/python3.9/site-packages/mysql/connector/connection.py, line 276, in _auth_switch_request
Python Executable: /usr/bin/pythonThis is settings.py for mariadb database connection:
Code:DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'test',
'USER': 'root',
'PASSWORD': '12345',
'HOST': 'localhost',
'PORT': '8083',
}
}I also gave the 'root'@'localhost' gran access to all mariadb databases.