If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Cannot grant execute on procedure

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-27-10, 18:39
schmintan schmintan is offline
Registered User
 
Join Date: Jul 2004
Posts: 5
Cannot grant execute on procedure

I have mysql installed on my mac.

I am logged in as root and have created user1 and granted the following access to the database, sproc, and table in question (gotten by executing show grants for current_user:
Code:
| GRANT USAGE ON *.* TO 'user1'@'localhost' IDENTIFIED BY PASSWORD '*F29D00D619BC53E42CD9872D41B9A05F2FD32540' |
| GRANT EXECUTE ON `test`.* TO 'user1'@'localhost'                                                             |
| GRANT SELECT ON `test`.`testtable` TO 'user1'@'localhost'                                                    |
| GRANT EXECUTE ON PROCEDURE `test`.`firstprocget` TO 'user1'@'localhost'

When i log on as user 1, change the database context to "test" database, and try to exec the sproc i get the following error:

Code:
mysql> call firstProcGet;
ERROR 1370 (42000): execute command denied to user ''@'localhost' for routine 'test.firstProcGet'
ive removed and recreated the user a number of times but cant get this issue resolved. any ideas?

edit: the sproc was created by root, in case that matters.

also, if i run the below command to grant all privileges, it works, so i dont know where the happy medim is:
Code:
grant all privileges on *.* to user1@localhost;

Last edited by schmintan; 10-27-10 at 18:54.
Reply With Quote
  #2 (permalink)  
Old 10-28-10, 04:57
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 623
Hi,

when issuing the grant you are placing the procedure name inside `which indicates that the procedure is case sensitive. I have done the same thing as follows:

Code:
mysql> GRANT USAGE ON seminar.* TO 'user1'@'localhost' IDENTIFIED BY 'user1';
Query OK, 0 rows affected (0.01 sec)
mysql> grant execute on procedure seminar.myproc to user1@localhost;
Query OK, 0 rows affected (0.05 sec)
rcashell@linux:~> mysql -u user1 -p -D seminar
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 207
Server version: 5.0.45 SUSE MySQL RPM

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

mysql> call myproc(@x);
Query OK, 0 rows affected (0.02 sec)

mysql> select @x;
+------+
| @x   |
+------+
| 3    | 
+------+
1 row in set (0.00 sec)
__________________
Ronan Cashell
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
  #3 (permalink)  
Old 10-28-10, 08:10
schmintan schmintan is offline
Registered User
 
Join Date: Jul 2004
Posts: 5
Thanks for the response. no, im not placing the sproc name inside quotes. I have tried the command with the username and domain both inside and outside comments but to the same result.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On