通过show grants for ‘username’@’ip’查看用户授权信息;
    通过revoke xxx from ‘username’@’ip’撤销用户权限。
    如:

    1. 创建用户

      1. create user 'readonly'@'%' identified with mysql_native_password by 'Aa123456,';
    2. 用户授权

      grant select,delete on *.* to 'readonly'@'%';
      grant insert on *.* to 'readonly'@'%';
      
    3. 看用户授权

      show grants for 'readonly'@'%'\G
      

    image.png

    1. 撤销用户权限

    撤销readonly用户的insert和delete权限。

    revoke insert,delete on *.* from 'readonly'@'%';
    

    再检查readonly权限可以看到只剩下select权限了。

    image.png