0

pymysql.err.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GRANT ALL PRIVILEGES ON `test-db`.* TO `test-user`' at line 1")

Getting above python error, but when I execute the query from workbench its executing perfectly fine

New to python here

smali
  • 4,687
  • 7
  • 38
  • 60
  • Show complete code which executes this statement - we cannot predict it. – Akina Jul 29 '22 at 10:18
  • 1
    The user name should have an @ in it, and user and host part should be quoted using regular single quotes, not backticks. E.g. GRANT ALL PRIVILEGES ON `test-db`.* TO 'test-user'@'localhost'; – Hartmut Holzgraefe Jul 29 '22 at 10:56
  • This is not a python error, this is a mysql error. Is there any sql statement before the grant one? – Shadow Jul 29 '22 at 11:41
  • Thanks @All, sorry the issue was https://stackoverflow.com/questions/33232830/newline-and-dash-not-working-correctly-in-jinja jinja is not separting the queries and due to that it was throwing the error my bad – smali Jul 29 '22 at 12:12

0 Answers0