Solved

MySQL grant permission question

Posted on 2012-03-26
6
670 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
  • 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
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…

747 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

9 Experts available now in Live!

Get 1:1 Help Now