MySQL Forums
Forum List  »  Stored Procedures

Create User with Stored Procedure
Posted by: ebrahim espootin
Date: July 06, 2012 11:55AM

i need have a stored procedure for create user , but i have unexpected error!!! :(

this is my sp:

CREATE DEFINER = `root` @`localhost` PROCEDURE `P_CreateUser3` (
IN _Username NVARCHAR (30),
IN _Password NVARCHAR (32) IN _DBName VARCHAR (20)
)
BEGIN
CREATE USER _Username @'localhost' IDENTIFIED BY _Password ;
GRANT
SELECT,
UPDATE,
DELETE,
INSERT
ON
`programmer`.*
TO
_Username @'localhost'
WITH
GRANT OPTION ;
END $$

and this is error:

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 'IN _DBName VARCHAR (20)
)
BEGIN
CREATE USER _Username @'localhost' IDENTIFIED' at line 3

help me please.

Options: ReplyQuote


Subject
Views
Written By
Posted
Create User with Stored Procedure
3020
July 06, 2012 11:55AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.