[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How do I use GRANT in mysql to assign priviledges ?

Posted on 2010-09-07
3
Medium Priority
?
389 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Suggested Courses

649 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