0

In [2]: c=connection.cursor() i have written so it has been

The above exception was the direct cause of the following exception: OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: NO)")

DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME':'test', 'USER':'root', 'Password':'Antimk', 'HOST':'localhost', 'PORT':'', 'OPTIONS':{ 'init_command':"SET sql_mode='STRICT_TABLES'" }

what am I doing like this

Yash Mehta
  • 2,025
  • 3
  • 9
  • 20
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Mar 28 '23 at 08:37

1 Answers1

1

I think your MySQL root password is unset. As the error states: Access denied for user 'root'@'localhost' (using password: NO), you need to set a password for the user root or disable the authentication. Check this post to solve the problem, or this one. Even if not so reproducible, the Python snippet should connect fine. Also, I suggest you not to share your passwords.