zoukankan      html  css  js  c++  java
  • mysql 创建用户,授权

    一  .mysql创建用户:     mysql最高管理员账号 root  ,用于select, update, delete, grant(授权), 等等所有的权限     创建用户给不同的人员使用, 需要配置不同的权限, 创建用户, 默认不给权限,  只能连接
    use mysql //进入mysql 数据库下创建用户 create user "u1" @ "192.168.15.%" identified by "123"; //创建u1账号 识别身份(密码123) ,运行网段15.X的IP连接 create user "u2" @ "192.168.1.112" identified by "123"; //只允许u2在1.112的主机上面连接 create user "u3" @ "%" identified by "123"; //允许u3用户在所有ip上面连接
    删除用户: drop user "u3" @ "%"; //删除用户, 并且要指定所在IP
    修改用户: rename user "用户名" @ "IP地址" to "new name" @ "ip地址";
    修改密码: set password for "username"@ "ip" = Password("new pwd");
    二 . 用户授权: 查看用户权限: show grants for "用户"@ "IP";
    授权用户对单表db1.t1有 查/增/改权限: grant select,insert,update on db1.t1 to "u1"@"%";
    grant all privileges on db1.t1.to "u2"@"%"; //授权t1表所有权限给u2 除 grant权限外
    grant all privileges on dbl.* to "u2"@"%"; //授权db1库的所有权限给u2 除 grant权限外
    grant all privileges on * to "u2"@"%"; //授权所有库的所有权限给u2 除 grant权限外.
    取消权限: revoke all on db1.t1 from "u2"@"%"; //取消u2用户的db1.t1库的所有权限
    revoke all on db1.* from "u2"@"%"; // 取消u2用户拥有了db1库内的所有权限
    revoke all privileges on *.* from "u1"@"%"; // 取消远程用户的所有表上的权限
  • 相关阅读:
    HDU 3401 Trade
    POJ 1151 Atlantis
    HDU 3415 Max Sum of MaxKsubsequence
    HDU 4234 Moving Points
    HDU 4258 Covered Walkway
    HDU 4391 Paint The Wall
    HDU 1199 Color the Ball
    HDU 4374 One hundred layer
    HDU 3507 Print Article
    GCC特性之__init修饰解析 kasalyn的专栏 博客频道 CSDN.NET
  • 原文地址:https://www.cnblogs.com/tcpblog/p/9997709.html
Copyright © 2011-2022 走看看