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


    1 建立用户

        mysql>create user 'username'@'host' identified by 'password';
            host 指定用户登录位置, 本机登录为localhost,  任意主机为%

    2 用户授权
        mysql>grant privileges on dbname.tbname to 'username'@'host';
            privileges 权限列表     
             GRANT SELECT, INSERT ON test.user TO 'pig'@'%';
             GRANT ALL ON *.* TO 'pig'@'%';
             
    --------------------------------------------------------------------------------------------------------
    创建用户并授权
        mysql>grant privileges on dbname.tbname to 'username'@'host' identified by 'password' with grant option
         privileges 权限列表   
         with grant option 是授权给用户可以继续给他人授权
    --------------------------------------------------------------------------------------------------------         
             
    3 设置密码
        mysql>set password for 'username'@'host' =password('password');
            对当前登录用户设置密码: set password = password('password');
            
    4 撤销授权
        mysql>revoke privileges on dbname.tbname to 'username'@'host';
            通授权模式
            
    5 删除用户
        mysql>drop user 'username'@'host';
        
        
    6 设置生效
        mysql>flush privileges;    
                
           

  • 相关阅读:
    code light
    asp.net(C#)定时自动发送邮件
    示例代码(一)
    devExpress 7.2.5
    使用VSIUAL C#.NET操作Excel -把DataTable中的数据写入Excel
    C#日期格式化的几种处理方法
    配置
    关于Windows 2008 R2 Web服务器环境搭建、安全流程
    安全
    FTP 用户目录病隔离
  • 原文地址:https://www.cnblogs.com/cpython/p/3625820.html
Copyright © 2011-2022 走看看