Monday, October 9, 2017

Re: Access denied for MySQL user in Django

Hi,
as far as i understood cdraccess  is a DB gust user, right?

If so, from your DB admin user, grant cdraccess to access MySQL environment table 'mysql.user' as follow:
 
GRANT SELECT ON `mysql`.`user` TO 'cdraccess'@'%';

To me it worked,
Ivan

On Thursday, January 14, 2016 at 2:27:27 PM UTC+1, Galil wrote:

I have created a Django app and which uses MySQL. The settings.py file in the database sections is:

DATABASES = {      'cdraccess': {          'ENGINE': 'django.db.backends.mysql',          'NAME': os.environ.get('CDR_DB_NAME', 'portal2'),          'USER': os.environ.get('CDR_DB_USER', 'cdraccess'),          'HOST': os.environ.get('CDR_DB_HOST', '127.0.0.1'),          'CONN_MAX_AGE': 0,          'PASSWORD': os.environ.get('CDR_DB_PASSWORD', ''),      },      'default': {          'ENGINE': 'django.db.backends.sqlite3',          'NAME': 'db.sqlite3',      }  }

I run the app like:

CDR_DB_PASSWORD='password' CDR_DB_HOST='host_name' ./manage.py runserver

but I get the following error:

Access denied for user 'cdraccess'@'host_ip_here' (using password: NO)")

I tried to access the database from terminal, like:

   $ mysql --host=[host_name] --user=cdraccess -p portal2

and worked fine.

What is going wrong in here? And what does this "(using password: NO)" mean?


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/71856d5f-d404-4637-8497-1203108d101a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment