LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-13-2021, 11:42 PM   #1
shams
Member
 
Registered: Jan 2004
Posts: 537

Rep: Reputation: 30
django mariadb connection error : 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)


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/python
This 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.

Last edited by shams; 07-14-2021 at 12:23 AM.
 
Old 07-14-2021, 12:44 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,175
Blog Entries: 1

Rep: Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042
Quote:
This 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'm not familiar with django, but I guess in the above config file, the PORT should be the mysql/mariadb port, that is 3306 (by default)
 
Old 07-14-2021, 01:05 AM   #3
shams
Member
 
Registered: Jan 2004
Posts: 537

Original Poster
Rep: Reputation: 30
when i use the port 3306 get the error:
Code:
# python manage.py runserver 192.168.1.100:3306
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
July 14, 2021 - 10:34:02
Django version 3.2.5, using settings 'CSCdropdown.settings'
Starting development server at http://192.168.1.100:3306/
Quit the server with CONTROL-C.
Error: That port is already in use.
 
Old 07-14-2021, 01:24 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,175
Blog Entries: 1

Rep: Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042
Quote:
Originally Posted by shams View Post
when i use the port 3306 get the error:
Code:
# python manage.py runserver 192.168.1.100:3306
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
July 14, 2021 - 10:34:02
Django version 3.2.5, using settings 'CSCdropdown.settings'
Starting development server at http://192.168.1.100:3306/
Quit the server with CONTROL-C.
Error: That port is already in use.
The port 3306 is the mysql port, used to connect to the database server!
If your project is running on port 8083 as in your OP, you should use:
Code:
python manage.py runserver 192.168.1.100:8083
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) jsaravana87 Linux - Server 2 09-02-2011 10:22 AM
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) bobby953 Linux - Software 21 03-24-2011 08:35 PM
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) shogun1234 Linux - Server 1 06-15-2009 11:12 AM
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) S canegames Debian 11 07-18-2007 12:57 PM
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) mohtasham1983 General 2 04-02-2007 06:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration