Solved

How do I use GRANT in mysql to assign priviledges ?

Posted on 2010-09-07
3
377 Views
Last Modified: 2012-05-10
Hello Guys,

I have a mysql database online. I have created a user for e.g. mysite_user1. This user is associated with 2 databases.

1. DBSet1  (has couple of tables)
2. DBSet2  (has one table)

Now for DBSet1, user1 has select priviledge only and for dbset2 user has several priviledges which I have assigned thru wizard.

I want to create a stored procedure in DBSet1 and want user1 to execute stored procedures. How can I grant priviledge so that it can execute any no. of stores procedure and maintain its current select only priviledge for database DBSet1.

I mean hwo can I achieve the following :

- Grant user1 to execute any no. of stores procedures in Dbset1.
- Grant user1 to execute only a particular stored procedure in DBSet1.
- Ensure that its previous priviledge is intact (Select).
- priviledge should be for all tables in DBSet1.

Can someone write sample grant statements to achieve the same.

(For info: if the stored procedure contains update statement for that db I hope it works).

I will be glad if anyone can help me out.

Thanks,

Cheers,
Saurabh
0
Comment
Question by:Sukhani
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
Varghese Jacob earned 500 total points
ID: 33625251
- Grant user1 to execute any no. of stores procedures in Dbset1.
GRANT EXECUTE ON Dbset1.* TO 'user1'@'localhost';

- Grant user1 to execute only a particular stored procedure in DBSet1.
GRANT EXECUTE ON DBSet1.sp_name TO 'user1'@'localhost';

- Ensure that its previous priviledge is intact (Select).
The above statements shouldn't meddle with select privilege

- priviledge should be for all tables in DBSet1.
What privilege?
0
 

Author Comment

by:Sukhani
ID: 33633900
I have given privilege to a particular mysql user. Inspite of that when I execute a stored procedure i get error Select command access denied for user xxx@ipaddress...
I did -
GRANT Execute on procedure 'test' for sitename_user;
GRANT Execute on procedure 'test' for sitename_user@'%';
When I do show grants for that user, i do see select, execute on procedure for that subroutine but thru .net connector when I execute that subroutine I am unsuccessful. What should I do ?
0
 

Author Closing Comment

by:Sukhani
ID: 33635503
Solution could have been detailed.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PHP loop not working 4 55
Mysql Crashing Intermittently 16 82
Have issues with Query MySQL 9 55
How to load 2 images in same column in Delphi 2 34
Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now