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这个选项表示该用户可以将自己拥有的权限授权给别人

  • 相关阅读:
    verilog中的function用法与例子
    HDMI IP学习笔记
    include使用中注意的问题
    PCIE学习
    HDMI学习
    (转)modelsim10.0C编译ISE14.7的xilinx库(xilinx ip核)
    2014年七月华为校招机试题目--最难的一道, 呵呵!
    欧拉函数
    素数高效率筛选法
    树-二叉树的编号
  • 原文地址:https://www.cnblogs.com/9527mwz/p/11200643.html
Copyright © 2011-2022 走看看