MySQL Tutorial/Privilege/REVOKE — различия между версиями

Материал из SQL эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Версия 13:44, 26 мая 2010

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;