-1

I'm using MySQL v8.0.35 with django and python. A website is used to access the database with both the website and database hosted on AWS. When the website tries to access the database in any way, it throws this error:

 OperationalError: (1045, "Access denied for user '<user>'@'*****' (using password: NO)")

The main issue is that I do not understand why password is not being used by the website despite it being included with the database configuration in my django settings.py file.

To me this is weird because while ssh'ed into the website's instance am able to run this command:

mysqladmin -h <endpoint> -u <user> -p version

is the same from above and when I am prompted to input my password, It executes perfectly.

I am also able to log into the database running this command while ssh'ed:

mysql -h <endpoint> -u <user> -p

At which point I input the same password and am let in. When I check my user's permissions, it shows this

[

In the settings file django is using to grab any database info, this is what I have:

DATABASES={
    'default': {
        'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 'zombeewatch', # Or path to database file if using sqlite3.
        'USER': '<user>', # Not used with sqlite3.
        'PASSWORD': '<password>', # Not used with sqlite3.
        'HOST': '<endpoint>', # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '3306', # Set to empty string for default. Not used with sqlite3.
    }
}

I am also able to use python manage.py without any issues as well so the program seems to be able to grab the database, username, and password from my settings file just fine.

To be honest, I have no clue where to go from here. I think the main issue hinges on why the the website is trying to log into the database without a password when one is provided. I know there are a couple questions with this same error, but the context behind them seems to be very different. If I can provide anymore info, please let me know!

**Note that I have confirmed that the password I am using in the file is the correct one. At the very least, it is the same one I am copying and pasting when prompted for a password for the mysql and mysqladmin commands.

6
  • The error message says it's not using a password. What is the configuration of the website?
    – vidarlo
    Commented Mar 10 at 3:14
  • I don't quite understand, which configuration are you asking about?
    – Meep
    Commented Mar 10 at 4:16
  • Configuration of the website that gives you the error message.
    – vidarlo
    Commented Mar 10 at 4:17
  • It is configured to use the database as I posted above in the settings file that django is using. I'm not sure if you are asking about something else.
    – Meep
    Commented Mar 10 at 4:22
  • Well, is it configured to use a password for connecting to mySQL? You have a error message that says password is not used. Why?
    – vidarlo
    Commented Mar 10 at 4:25

1 Answer 1

0

A little embarrassed to say, but the issue was fixed by turning the website off and on again. I apologize because I realize this isn't too helpful.

Since I don't usually work with websites, I got used to changes being applied without a restart to the site. So when I previously made a change to the password field that didn't work, I didn't restart the site after the fact.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .