0

I am trying to connect to MySQL from DJango. My settings.py file:

DATABASES = {
          'default':{
             'ENGINE': 'django.db.backends.mysql',
             'Name': 'my_db',
             'User': 'my_user',
             'Password': 'my_pass',
             'Host': 'localhost',
             'Port': '3306'
          }
}

}

I am getting following error.

django.db.utils.OperationalError: (1045, u"Access denied for user 'my_user'@'localhost' (using password: NO)")

I have tried following steps to solve the problem.

I have created the user:

    create user 'my_user'@'localhost' identified by 'my_pass';

And granted access as follows:

    grant all on *.* to 'my_user'@'localhost';
    flush privileges;

But, even though my problem not yet fixed. Can someone help me?

Thanks.

1 Answers1

0

All the database config variables need to be caps but you have provided in title case.

DATABASES = {
      'default':{
         'ENGINE': 'django.db.backends.mysql',
         'NAME': 'my_db',
         'USER': 'my_user',
         'PASSWORD': 'my_pass',
         'HOST': 'localhost',
         'PORT': '3306'
      }
}
Ritesh Agrawal
  • 791
  • 4
  • 7