?
Solved

How do I use GRANT in mysql to assign priviledges ?

Posted on 2010-09-07
3
Medium Priority
?
387 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
Varghese Jacob earned 1500 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Lotus Notes has been used since a very long time as an e-mail client and is very popular because of it's unmatched security. In this article we are going to learn about  RRV Bucket corruption and understand various methods to Fix "RRV Bucket Corrupt…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

801 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