zoukankan      html  css  js  c++  java
  • mysql 8.0.12 创建并授权出现的问题

    mysql 8.0.12 创建并授权出现的问题

    实际代码

    mysql> grant all privileges on database.* to 'user'@'localhost' identified by 'password';
    

    异常信息

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'identified by 'password'' at line 1
    

    解决方案

    将用户创建过程和授权过程分开

    mysql> create user 'luffy'@'localhost' identified by  'luffy';
    Query OK, 0 rows affected (0.04 sec)
    
    mysql> grant all privileges on luffy.* to 'luffy'@'localhost' with grant option;
    Query OK, 0 rows affected (0.09 sec)
    
    mysql> flush privileges;
    Query OK, 0 rows affected (0.01 sec)
    

    flush privileges 命令本质上的作用是将当前user和privilige表中的用户信息/权限设置从mysql库(MySQL数据库的内置库)中提取到内存里

    创建用户::create user ‘用户名’@‘访问主机’ identified by ‘密码’;
    授予权限:grant 权限列表 on 数据库 to ‘用户名’@‘访问主机’ ;
    with grant option这个选项表示该用户可以将自己拥有的权限授权给别人

  • 相关阅读:
    uniapp
    vue -element admin 修改request,headers添加参数
    uniapp
    css
    uniapp
    uniapp
    vue
    vue
    vue -element 修复select下拉框在移动端需要点击两次才能选中的问题
    vue
  • 原文地址:https://www.cnblogs.com/9527mwz/p/11200643.html
Copyright © 2011-2022 走看看