Unable to connect mysql via django -
i know old question on lots of forums answers suggesting flush privileges , reset passwords in case no answer has worked.
here's scenario:
i able connect mysql via following command
mysql -u root -p -hlocalhost
i able connect via python using following script
import mysqldb con = mysqldb.connect(host="127.0.0.1", port=3306, user="root", passwd="mypass", db="mydb") cursor = con.cursor() sql = "select * test" cursor.execute(sql) #### gives 1l
but unable connect via django. django settings.py contains
databases = { 'default': { 'engine': 'django.db.backends.mysql', 'name': 'mydb', 'user': 'root', 'passwd': 'mypass', 'host': 'localhost', 'port': '3306', } }
following main error
django.db.utils.operationalerror: (1045, "access denied user 'root'@'localhost' (using password: no)")
please suggest.
the key password value in db settings should "password", not "passwd".
Comments
Post a Comment