• mysql授权、删除用户和角色权限


    备份权限

    GRANT USAGE ON *.* TO 'backup'@'172.16.0.157' IDENTIFIED BY PASSWORD '*38B4F16EADB1601E713D9F03F1DFA1F71C624A91';
    
    #GRANT USAGE ON *.* TO 'backup'@'172.16.0.157' IDENTIFIED BY  '123456';
    
    GRANT SELECT, LOCK TABLES, SHOW VIEW, TRIGGER ON `pccb_pre`.* TO 'backup'@'172.16.0.157';

    zabbix监控权限

    GRANT SELECT ON *.* TO 'zabbix'@'172.16.0.155' IDENTIFIED BY PASSWORD '*89AF6F71DE54E02F7D150CD66166A345C89DA896'
    或 GRANT USAGE ON *.* TO 'zabix'@'%' IDENTIFIED BY PASSWORD '*A15001023857EC31A1C5B477A8C75B2DDE18C7EE'


    授权

    #所有权限
    GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'root'@'192.168.80.4' identified by '123123123';
    
    #授权某两张表
    GRANT USAGE ON *.* TO 'pccbnbbs_r'@'172.16.0.159' IDENTIFIED BY  'jdt7zrLyuPrsizcfb.6t' ;给上海李小明
    GRANT SELECT ON `pccb_nbbs`.`article` TO 'pccbnbbs_r'@'172.16.0.159';                                      
    GRANT SELECT ON `pccb_nbbs`.`article_reply` TO 'pccbnbbs_r'@'172.16.0.159';
    
    all :表示所有操作增删改查
    库名:表示针对库具有的操作权限,任何库使用*
    表名:表示针对库中表具有的操作权限,任何表使用*
    user:登录用户名
    192.168.1.%:表示允许192.168.1这个网段的所有机器都具有登录权限。如果想任何电脑登录使用%
    identified by :设置登录密码
    授权完要权限刷新,就是让权限数据写入内存
    mysql> flush privileges;

    权限回收

    revoke select,delete on db.table from 'user'@'%'
    
    revoke all privileges on *.* from 3156dev@'%';

    #库及别
    delete from mysql.db where user='test' and host='%';

    #表及别
    delete from mysql.tables_priv where user='test' and host='%' ;

    查看授权

    select user,host from mysql.user where user='root';
    show grants for 'user'@'%'; #查看用户有哪些权限

    删除用户

    DROP USER 'backup'@'172.16.0.157';
    delete from mysql.user where user='xxxx' ans host='xxxxxx';

     修改密码

    set password for 'root'@'%' = 'xxx';
    update mysql.user set password=password('123456') where user='root' and host='%';
  • 相关阅读:
    spring复杂数据类型传递
    spring表单—乱码解决方案
    spring重定向与转发
    线程在WPF中的使用
    xheditor编辑器上传截图图片抓取远程图片代码
    js window.open()弹出窗口参数说明及居中设置
    INFORMATION_SCHEMA.COLUMNS 查询表字段语句
    SQL 使用Cursor(游标)遍历结果集
    js禁止浏览器滚屏方法
    基础-ADO插入数据后返回自增ID @@IDENTITY
  • 原文地址:https://www.cnblogs.com/hanxiaohui/p/8492371.html
Copyright © 2020-2023  润新知