Solved

MySQL grant permission question

Posted on 2012-03-26
6
723 Views
Last Modified: 2012-04-02
I want to grant a user delete permission to a database but got issue:

Suppose I have a database: sampleDatabase and a table: sampleTable, and username: sampleUser

What I did was:
grant usage on *.* to 'sampleUser'@'12.1.1.22' identified by password 'xxx';
grant select, insert, update, delete on 'sampleDatabase'.* to 'sampleUser'@'12.1.1.22'

But I still got 'delete permission denied for user: sampleUser@12.1.1.22'

When I specially granted permission to table level, it could work:
grant select, insert, update, delete on 'sampleDatabase'.'sampleTable' to 'sampleUser'@'12.1.1.22'

I have many tables in this database, so I can't grant permission one by one. I didn't experience such issue before when I used '*' to grant permission to all tables in a database.

Any hint? Thanks.
0
Comment
Question by:heyday2004
[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
  • 2
  • 2
6 Comments
 
LVL 24

Assisted Solution

by:johanntagle
johanntagle earned 167 total points
ID: 37769525
I cannot replicate the problem, but http://stackoverflow.com/questions/3891855/grant-delete-on-database-table-to-username seems to describe the same situation as yours.
0
 

Author Comment

by:heyday2004
ID: 37769831
Thanks. Still wondering if what the issue is.

When I use:
select * from mysql.db where User = 'xxx' and Host='xxx'
I could see the delete_priviledge is "Y". But when I tried to delete record, it still reported "permission denied". I have to grant delete permission to a table level to delete records.

One thing I notice is: select * from mysql.host returns zero. Does it matter if there is no record in mysql.host table?

Thanks for any hint.
0
 
LVL 21

Assisted Solution

by:theGhost_k8
theGhost_k8 earned 333 total points
ID: 37770614
Issue following on mysql prompt:
Flush Privileges;
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

Author Comment

by:heyday2004
ID: 37771271
I did that, still no change.
0
 
LVL 21

Accepted Solution

by:
theGhost_k8 earned 333 total points
ID: 37775056
when you're connected to mysql server, what did you see when you issue below command:
show grants for current_user();
0
 
LVL 24

Expert Comment

by:johanntagle
ID: 37799465
Thanks but can I request the asker to post how the problem was solved?  More for the benefit of those who will see this thread in the future.  Thanks.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

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…
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
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…

734 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