Warm tip: This article is reproduced from stackoverflow.com, please click
database django python mariadb

django.db.utils.OperationalError: (1044, "Access denied for user 'someuser'@'localhost' to database

发布于 2020-03-29 20:58:39

I have tried dropping all users and databases and re-creating. I have granted all privileges to my user. I have made sure my settings.py includes the correct setup... for the record here is what I have:

DIR_FOR_DB = '/path/to/'
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': DIR_FOR_DB+ 'Database',
        'USER': 'someuser',
        'PASSWORD': 'password',
        'HOST': 'localhost',
        'PORT': '',
    }
}

I can't think of any reason why it's not letting me in.

Questioner
user7613100
Viewed
189
CalMac 2020-01-31 18:07

Try this:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'Database',
        'USER': 'someuser',
        'PASSWORD': 'password',
        'HOST': 'localhost',
        'PORT': '8000',

You need to specify a port and not have a path on the database name.