mysql 权限管理

---恢复内容开始---

grant all privileges  on  database.table to 'user'@'ip' identified by 'passwd' with grant  option;

grant  select,insert on mt.* to 'mtp'@'192.168.25.20' identified by 'meal123456' with  grant  option;

删除权限

revoke drop on mt.* from 'mtp'@'192.168.25.20';

查权限

show  grants for mtp@'192.168.25.20';

---恢复内容结束---

grant all privileges  on  database.table to 'user'@'ip' identified by 'passwd' with grant  option;

grant  select,insert on mt.* to 'mtp'@'192.168.25.20' identified by 'meal123456' with  grant  option;

删除权限

revoke drop on mt.* from 'mtp'@'192.168.25.20';

查权限

show  grants for mtp@'192.168.25.20';

查看mysql数据库中所有用户 
mysql> SELECT DISTINCT CONCAT('''',user,'''@''',host,''';') AS query FROM mysql.user; 

查看数据库中具体某个用户的权限 
mysql> show grants for 'cactiuser'@'%';

原文地址:https://www.cnblogs.com/hanxing/p/8024786.html