zoukankan      html  css  js  c++  java
  • mysql权限管理

    权限管理(root)
        1、创建账号
            # 本地账号
            create user'egon1'@'localhost' identified by '123';  # mysql -uegon1 -p123
            # 远程账号,客户端ip(192.168.31.10)
            create user'egon1'@'192.168.31.10' identified by '123';  # mysql -uegon1 -p123 -h 服务端ip
            create user'egon1'@'192.168.31.%' identified by '123';  # mysql -uegon1 -p123 -h 服务端ip
            create user'egon1'@'%' identified by '123';  # mysql -uegon1 -p123 -h 服务端ip
        3、授权
            user: *.*  ## 所有表所有权限
            db: db1.*  ## db1库下所有权限
            tables_priv: db1.t1  ## 表t1
            columns_priv: id,name  ## 表中字段
            
            放权
            grant all on *.* to 'egon1'@'localhost';
            grant select on *.* to 'egon1'@'localhost';
            
            回收权限
            revoke select on *.* from 'egon1'@'localhost';
            
            select * from mysql.userG  ## cmd命令查看
            
            对库
            grant select on db1.* to 'egon1'@'localhost';
            revoke select on db1.* from 'egon1'@'localhost';
            
            对表
            grant select on db1.t1 to 'egon1'@'localhost';
            revoke select on db1.t1 from 'egon1'@'localhost';
            
            对字段
            grant select(id,name),update(age) on db1.t1 to 'egon1'@'localhost';
            revoke select(id,name),update(age) on db1.t1 from 'egon1'@'localhost';

  • 相关阅读:
    iOS URL中汉字的编码和解码
    指针函数和函数指针
    面试题1:赋值运算符函数
    线程安全的单实例模式
    大数相加
    网格走法
    stringstream字符串流的妙用
    判断一棵二叉树是否为二叉排序树
    idea 从javadoc中复制内容出来
    idea开启jquery提示及如何找到学习目标
  • 原文地址:https://www.cnblogs.com/fmgao-technology/p/9219640.html
Copyright © 2011-2022 走看看