开发者

Listing all users with DROP/DELETE privileges

开发者 https://www.devze.com 2023-02-21 22:04 出处:网络
How do I list all users who ha开发者_高级运维ve DROP/DELETE privileges in mySQL?select * from mysql.user where Delete_priv = \'Y\' and Drop_priv = \'Y\';

How do I list all users who ha开发者_高级运维ve DROP/DELETE privileges in mySQL?


select * from mysql.user where Delete_priv = 'Y' and Drop_priv = 'Y';


u can use show grants

SHOW GRANTS;

and see the users that have a delete/drop/all privileges


Note, that user's privileges can be granted at some levels.

-- Global level privileges
SELECT CONCAT(user, '@', host) FROM mysql.user WHERE delete_priv = 'Y' OR drop_priv = 'Y'

-- Table level privileges
SELECT CONCAT(user, '@', host) FROM mysql.tables_priv WHERE FIND_IN_SET('delete', table_priv) <> 0 OR FIND_IN_SET('drop', table_priv) <> 0

There also can be database level privileges (see mysql.db table).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号