• grant


    # 添加超级用户
    grant all privileges  on *.* to 'dump_tmp'@'10.10.10.10' identified by 'dump_tmp';
    grant all privileges on *.* to 'tmp'@'10.%' identified by 'tmp' with grant option;
    grant all privileges on *.* to 'tmp'@'127.0.0.1' identified by password '*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9' with grant option;
    
    # 删除超级用户
    drop user dump_tmp@'10.10.10.10';
    
    > 
    
    # 其中将“123456”加密后的密码就是“*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9”,根据自己的需要来添加用户的密码。
     > select password('123456');
    +-------------------------------------------+
    | password('123456')                        |
    +-------------------------------------------+
    | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
    +-------------------------------------------+
    1 row in set (0.00 sec)
    
    Mon Nov 25 09:44:19 2019
     > 
    
    ##########################################
    原来的权限:
     > show grants for 'glc_x'@'10.10.10.10';
    +-----------------------------------------------------------------------------------------+
    | Grants for glc_x@10.10.10.10                                                    |
    +-----------------------------------------------------------------------------------------+
    | GRANT USAGE ON *.* TO 'glc_x'@'10.10.10.10'                                       |
    | GRANT SELECT, INSERT, UPDATE, DELETE ON `ms`.* TO 'glc_x'@'10.10.10.10'     |
    | GRANT SELECT, INSERT, UPDATE, DELETE ON `metadata`.* TO 'glc_x'@'10.10.10.10' |
    ##############
    新增权限:
    >  grant select,insert,update,delete on `rd`.* to 'glc_x'@'10.136.26.35';
    ##############
    现在的权限:
    > show grants for 'misc_cms_x'@'10.10.10.10'; +-----------------------------------------------------------------------------------------+ | Grants for misc_cms_x@10.10.10.10 | +-----------------------------------------------------------------------------------------+ | GRANT USAGE ON *.* TO 'glc_x'@'10.10.10.10' | | GRANT SELECT, INSERT, UPDATE, DELETE ON `rd`.* TO 'glc_x'@'10.10.10.10' | | GRANT SELECT, INSERT, UPDATE, DELETE ON `ms`.* TO 'glc_x'@'10.10.10.10' | | GRANT SELECT, INSERT, UPDATE, DELETE ON `metadata`.* TO 'glc_x'@'10.10.10.10' | +-----------------------------------------------------------------------------------------+ 4 rows in set (0.00 sec) Wed Dec 18 11:50:34 2019 >
    ##########################################
    重新加载一下配置,才能有效(仅仅针对公司)
    ./load reload
    ##########################################

    查看用户权限:

    show grants for 'user'@'host';   

    使用超级用户在线备份数据库

    mysql -udump_tmp -pdump_tmp -hXXX -P3306   -e 'show databases;' | grep -Ev 'Database|information_schema|mysql|performance_schema|sys' | xargs mysqldump --set-gtid-purged=off  -udump_tmp -pdump_tmp -hXXX -P3306   --single-transaction --master-data=2  --databases > data_backup.sql
    
    pt-show-grants -udump_tmp -pdump_tmp  -hXXX -P3306  >grant_backup.sql
  • 相关阅读:
    Serverless 时代下大规模微服务应用运维的最佳实践
    Dubbo 跨语言调用神兽:dubbo-go-pixiu
    Flink 1.12 资源管理新特性回顾
    [JDBC] Kettle on MaxCompute 使用指南
    AI运动:阿里体育端智能最佳实践
    MaxCompute非事务表如何更新数据
    如何利用云原生技术构建现代化应用
    实时数仓入门训练营:实时计算 Flink 版 SQL 实践
    实时数仓入门训练营:基于 Apache Flink + Hologres 的实时推荐系统架构解析
    Flink + Iceberg + 对象存储,构建数据湖方案
  • 原文地址:https://www.cnblogs.com/igoodful/p/11855164.html
Copyright © 2020-2023  润新知