-1

GRANT ALL ON *.* TO demoemployee@'1.5.6.4' IDENTIFIED BY 'my_password'

Error: 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 'IDENTIFIED BY 'my_password'' at line 1

I don't see any issue with the syntax above but still, it's not working and adding an extra ' on the end of my query.

I've tried this on my MySQL server 8.xx and on online tools like this: https://en.rakko.tools/tools/36/

I've also tried few other queries but couldn't solve.

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'my_password'

How Should I resolve this?

Code Cooker
  • 881
  • 14
  • 19
  • Create the user first if it is not created yet with: `create user 'demoemployee'@'1.5.6.4' IDENTIFIED BY 'my_password';` and then grant the permission: `GRANT ALL PRIVILEGES ON *.* TO 'demoemployee'@'1.5.6.4'` – Ergest Basha Dec 27 '21 at 09:14
  • @ErgestBasha Doesn't really work. – Code Cooker Dec 27 '21 at 12:16

1 Answers1

0

Comparing the documentation of GRANT in MySQL 5.7 to those of 8.0 reveals that authentication characteristics are no longer supported. The 5.7 version also explicitly warns that they already are deprecated in 5.7 and are subject to removal in future versions:

Note

Use of GRANT to define account authentication characteristics is deprecated in MySQL 5.7. Instead, establish or change authentication characteristics using CREATE USER or ALTER USER. Expect this GRANT capability to be removed in a future MySQL release.

So simply remove IDENTIFIED BY 'my_password'.

sticky bit
  • 36,626
  • 12
  • 31
  • 42