MySQL Forums
Forum List  »  Quality Assurance

CREATE ROUTINE privilege problem
Posted by: bruno rossi
Date: December 28, 2007 12:09PM

Reference Guide 5.0
The CREATE ROUTINE, ALTER ROUTINE, EXECUTE, and GRANT privileges apply to stored routines (functions and procedures). They can be granted at the global and database levels. Also, except for CREATE ROUTINE, these privileges can be granted at the routine level for individual routines and are stored in the mysql.procs_priv table.

GRANT CREATE ROUTINE ON mydb.* TO 'someuser'@'somehost';
GRANT EXECUTE ON PROCEDURE mydb.myproc TO 'someuser'@'somehost';


I'm logging as root

--------------------------------------------------------------------------

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 81
Server version: 5.0.45-community-nt MySQL Community Edition (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql (root@localhost) [DB:(none)] > show grants;
*************************** 1. row ***************************
Grants for root@localhost: GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '************' WITH GRANT OPTION
1 row in set (0.00 sec)

mysql (root@localhost) [DB:(none)] > GRANT ALL PRIVILEGES ON annunci.* TO 'myuser'@'localhost' IDENTIFIED BY '**********';
Query OK, 0 rows affected (0.00 sec)

mysql (root@localhost) [DB:(none)] > flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql (root@localhost) [DB:(none)] > \q

------------------------------------------------------------------------------

I'm logging as the new created user and I expect that 'myuser'@localhost' has been granted with CREATE ROUTINE privilege

------------------------------------------------------------------------------

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 84
Server version: 5.0.45-community-nt MySQL Community Edition (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql (myuser@localhost) [DB:(none)] > show grants;
*************************** 1. row ***************************
Grants for myuser@localhost: GRANT USAGE ON *.* TO 'myuser'@'localhost' IDENTIFIED BY PASSWORD '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19'
*************************** 2. row ***************************
Grants for myuser@localhost: GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON `annunci`.* TO 'myuser'@'localhost'
2 rows in set (0.00 sec)

mysql (myuser@localhost) [DB:(none)] > show databases;
*************************** 1. row ***************************
Database: information_schema
*************************** 2. row ***************************
Database: annunci
2 rows in set (0.00 sec)

mysql (myuser@localhost) [DB:(none)] > use annunci;
Database changed

mysql (myuser@localhost) [DB:annunci] > CREATE PROCEDURE testmy() SET @a = 1;
ERROR 1044 (42000): Access denied for user 'myuser'@'localhost' to database 'annunci'

---------------------------------------------------------------------------------

Why the CREATE ROUTINE isn't in the privileges list of 'myuser'?
If i try to use GRANT CREATE ROUTINE ON *.* TO 'myuser'@'localhost' the story remains the same...

Options: ReplyQuote


Subject
Views
Written By
Posted
CREATE ROUTINE privilege problem
8783
December 28, 2007 12:09PM


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.