Answer the question
In order to leave comments, you need to log in
Setting user permissions with a dynamic query?
I create a dynamic query in a stored procedure to create a user. The creation of the user itself goes fine, but when you try to set the rights for him, an error pops up:
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 USAGE ON *.* TO 'malan1'@'localhost'' at line 2
set @new_user_create=CONCAT(
'CREATE USER ''malan1''@''localhost'';
GRANT USAGE ON *.* TO ''malan1''@''localhost'';');
PREPARE cu FROM @new_user_create;
EXECUTE cu;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question