MySQL Tutorial/Privilege/REVOKE

Материал из SQL эксперт
Версия от 09:49, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

No other database can allow any user to connect from any host.

DELETE FROM db
WHERE (db.Host = "%");

DELETE FROM db
WHERE (db.User = "");


Removing Permissions from a Database

SELECT db.User, db.Host, db.Db
FROM db
WHERE (db.Db LIKE "test%");
DELETE FROM db
WHERE (db.Db LIKE "test%");


Removing Permissions from a User

DELETE FROM user
WHERE ((user.Host = "%") OR (user.User = ""));

mysql>


Revoking privileges

Revoking privileges is almost identical to granting them as you simply substitute RE VOKE.... FROM for GRANT....TO and omit any passwords or other options.

For example to REVOKE the privileges assigned to a user called "bad":



mysql> REVOKE ALL PRIVILEGES
    -> ON myDatabase.*
    -> FROM bad@localhost;


To remove UPDATE, INSERT and DELETE privileges

REVOKE INSERT,UPDATE,DELETE
 ON myDatabase.*
 FROM bad@localhost;