0

The syntax is this:

CREATE USER 'Adrian' IDENTIFIED BY 'Admin';

GRANT ALL ON `Spital`.* TO 'Adrian';
GRANT SELECT, INSERT, TRIGGER, UPDATE, DELETE ON TABLE `Spital`.* TO 'Adrian';
GRANT SELECT, INSERT, TRIGGER ON TABLE `Spital`.* TO 'Adrian';
GRANT SELECT ON TABLE `Spital`.* TO 'Adrian';
GRANT EXECUTE ON ROUTINE `Spital`.* TO 'Adrian';

How can I create the routine?

This is what is showing after that syntax:

CREATE USER 'Adrian' IDENTIFIED BY 'Admin'

Error Code: 1396. Operation CREATE USER failed for 'Adrian'@'%'

Stu
  • 30,392
  • 6
  • 14
  • 33

1 Answers1

0

This error occurs when you first deleted a user with DELETE FROM ... and are now trying to recreate it. You first need to say DROP USER ... then you can recreate again.

for more details you can check: https://sebhastian.com/mysql-error-1396/#:~:text=The%20MySQL%20ERROR%201396%20occurs,from%20your%20MySQL%20database%20server.

  • Error Code: 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 '`spital`.* TO 'Adrian'' at line 1 – Cristian Octavian Manea Apr 02 '22 at 11:56
  • this annother error that i have – Cristian Octavian Manea Apr 02 '22 at 11:57
  • you need to use single quotes -> 'Adrian' – Leonardo Repolust Apr 02 '22 at 12:12
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 02 '22 at 12:57