stryga42
Benutzer
- Beiträge
- 7
Probably a newbie-question...
I try to use a procedure to grant privileges to users where the user name is an IN parameter of the procedure. Like
Is there some magic about parameters or how GRANT treats the username?
The call is executed as root of the DB, so privileges should be in place.
Many thanks!
I try to use a procedure to grant privileges to users where the user name is an IN parameter of the procedure. Like
Lets assume user foo exist, a CALL mybd.CreateUserP('foo'); fails withDELIMITER //
CREATE PROCEDURE mydb.CreateUserP(IN username TEXT)
BEGIN
GRANT Usage ON *.* TO username;
GRANT Update ON mydb.* TO username;
END;
//
DELIMITER ;
If I modify the procedure to a hard-coded user nameSQL Error [1133] [28000]: (conn=148) Can't find any matching row in the user table
and it works (although it doesn't make much sense).DELIMITER //
CREATE PROCEDURE mydb.CreateUserP(IN username TEXT)
BEGIN
GRANT Usage ON *.* TO 'foo';
GRANT Update ON mydb.* TO 'foo';
END;
//
DELIMITER ;
Is there some magic about parameters or how GRANT treats the username?
The call is executed as root of the DB, so privileges should be in place.
Many thanks!