Solved

How do I use GRANT in mysql to assign priviledges ?

Posted on 2010-09-07
3
375 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
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…

707 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

15 Experts available now in Live!

Get 1:1 Help Now