Can someone help me with privileges here. I need to create a user that can DROP tables within databases but cannot DROP the databases?

From what I understand from MySQL docs you cannot simply do this:

The DROP privilege enables you to drop (remove) existing databases, tables, and views. Beginning with MySQL 5.1.10, the DROP privilege is also required in order to use the statement ALTER TABLE ... DROP PARTITION on a partitioned table. Beginning with MySQL 5.1.16, the DROP privilege is required for TRUNCATE TABLE (before that, TRUNCATE TABLE requires the DELETE privilege).

Any ideas?


Oh, and the dabase in use is 5.0.45.

link|improve this question

71% accept rate
feedback

2 Answers

up vote 0 down vote accepted

I have a same problem :( I think if user can drop all tables then empty database is no value

link|improve this answer
feedback
  1. create user
  2. give drop permissions to the user for said database
link|improve this answer
Nope. Doesn't work. If you give DROP permission to the user on a database, he'll be able to drop this particular database as well as the tables. – Michal M May 27 '10 at 8:25
It turns out that this is a constant in mysql 5, if the user has drop permissions, they'll be able to drop the database in which they have that permission. cite: dev.mysql.com/doc/refman/5.1/en/… – zamabe May 27 '10 at 15:14
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.