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;    
                
           

  • 相关阅读:
    WEB环境安装步骤v1.2
    将m3u8格式转成mp4格式
    MySQL简介及安装v0.1
    使用脚本pull阿里云的k8s镜像并更改标签
    常用脚本
    常用命令
    记录一下环境变量IFS特定场景使用技巧
    hp-unix创建和更改LV
    HP-UNIX常用命令
    Linux集群搭建
  • 原文地址:https://www.cnblogs.com/cpython/p/3625820.html
Copyright © 2011-2022 走看看