zoukankan      html  css  js  c++  java
  • mysql数据库创建用户并且赋权

    1.创建用户

    create table 'yyf'@'%' identitied by '123'

    注意:
    此处的"%",表示在任何一台电脑上都可以登录。也可以指定某台机器可以远程登录。将"%"改为"localhost",指的是该用户只能在本地登录,不能再另一台机器上远程登录

    2.查询用户

    select user,host from mysql.user

    3.用户赋予权限

    授予特定的权限 可自选

    grant create,alter,drop,select,insert,update,delete on test.* to yyf@'%';

    赋予全部权限

    grant all privileges on test.* to 'yyf'@'%'   identified by '123';

    刷新权限

    flush privileges;

    4.更改密码

    --方法1,密码实时更新;修改用户“test”的密码为“1122”

    set password for yyf=password('1122');

    --方法2,需要刷新;修改用户“test”的密码为“1234”

    update mysql.user set password=password('1234') where user='yyf'

    --刷新

    flush privileges;

    5.查看用户权限

    show grants for yyf;

    6.删除用户

    drop user yyf@'%';

  • 相关阅读:
    移动端上拉下拉刷新组件
    linux ftp搭建
    asp.net core 在Ubuntu 运行
    go can't find import: "github.com/** 错误
    WPF
    总结
    ASP.net
    计算器简单封装和ASP.net
    用户故事
    四则运算.结对编程
  • 原文地址:https://www.cnblogs.com/yyfyl/p/15090499.html
Copyright © 2011-2022 走看看