Mysql Grant权限

查看用户权限:

SELECT host,user,password,Grant_priv,Super_priv FROM mysql.user;

权限取决于最上一条记录的值

 

如果需要收回权限:

REVOKE ALL PRIVILEGES ON *.* FROM ‘root‘@‘ip1‘;

上面这条SQL将置Grant_priv,Super_priv为N,即使接下来执行SQL:

GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY PASSWORD ‘*XXXXX‘ WITH GRANT OPTION;

也不能拯救ip1的无权限,因为上面说了,权限取决于先匹配到的那条记录,最好的方法是:

delete from mysql.user where user=‘root‘ and host=‘ip1‘

   

 


  

  

 

Mysql Grant权限

上一篇:MyBatis SQL 语句构建器


下一篇:数据库索引原理