mysql5.7版本开始创建用户需要create user

5.7版本之后,直接使用:grant select on MySQL.test01 to hug@localhost; 是不行的,会报错:

Error Code: 1133. Can't find any matching row in the user table

5.7版本创建用户需要这样:

CREATE USER hug@localhost IDENTIFIED BY '123456';

grant all on mysql.* to hug@localhost;

官方文档是这样给的:

The preferred method is to use account-management statements because they are more concise and less
error-prone than manipulating the grant tables directly. All such statements are described in Section 13.7.1,
“Account Management Statements”. Direct grant table manipulation is discouraged, and is not described
here. The server is free to ignore rows that become malformed as a result of such modifications.
Another option for creating accounts is to use the GUI tool MySQL Workbench. Also, several third-party
programs offer capabilities for MySQL account administration. phpMyAdmin is one such program.
The following examples show how to use the mysql client program to set up new accounts. These
examples assume that privileges have been set up according to the defaults described in Section 2.10.4,
“Securing the Initial MySQL Accounts”. This means that to make changes, you must connect to the MySQL
server as the MySQL root user, which has the CREATE USER privilege.
First, use the mysql program to connect to the server as the MySQL root user:
shell> mysql --user=root mysql
If you have assigned a password to the root account, you must also supply a --password or -p option.
After connecting to the server as root, you can add new accounts. The following example uses CREATE
USER and GRANT statements to set up four accounts:
mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'

mysql5.7版本开始创建用户需要create user的更多相关文章

  1. MySQL5.7 mysql.user创建用户

    mysql -uroot -proot MySQL5.7 mysql.user表没有password字段改 authentication_string: 一. 创建用户: 命令:CREATE USER ...

  2. mysql5.7创建用户授权删除用户撤销授权

    一, 创建用户: 命令: CREATE USER 'username'@'host' IDENTIFIED BY 'password'; 说明:username - 你将创建的用户名, host - ...

  3. MYSQL创建用户和授权方法(测试mysql5.7)

    一.创建用户:  命令:CREATE USER 'username'@'host' IDENTIFIED BY 'password'; 说明:username - 你将创建的用户名, host - 指 ...

  4. oracle创建用户ORA-01045:user lacks CREATE SESSION privilege;

    conn internal/oracle grant user aaaa identified by aaaa; conn aaaa/aaaa 会报错: SQL>conn aaaa/aaaa 会 ...

  5. mysql 创建用户、设置权限

    MySQL创建用户与授权 一. 创建用户 命令: CREATE USER 'username'@'host' IDENTIFIED BY 'password'; 说明: username:你将创建的用 ...

  6. Oracle 12c创建用户时出现“ORA-65096: invalid common user or role name”的错误

    这篇文章主要介绍CDB和PDB的基本管理,资料来源oracle官方. 基本概念: Multitenant Environment:多租户环境 CDB(Container Database):数据库容器 ...

  7. Oracle创建用户、角色、授权、建表

    oracle数据库的权限系统分为系统权限与对象权限.系统权限( database system privilege )可以让用户执行特定的命令集.例如,create table权限允许用户创建表,gr ...

  8. SQLServer创建用户登录

    创建用户登录注意事项 密码是区分大小写的. 只有创建SQL Server登录时,才支持对密码预先进行哈希运算. 如果指定MUST_CHANGE,则CHECK_EXPIRATION和 CHECK_POL ...

  9. [转载]Oracle创建用户、角色、授权、建表

    出处:https://www.cnblogs.com/roger112/p/7685307.html oracle数据库的权限系统分为系统权限与对象权限.系统权限( database system p ...

随机推荐

  1. 一本通网站 1378:最短路径(shopth)

    [题目描述] 给出一个有向图G=(V, E),和一个源点v0∈V,请写一个程序输出v0和图G中其它顶点的最短路径.只要所有的有向环权值和都是正的,我们就允许图的边有负值.顶点的标号从1到n(n为图G的 ...

  2. 【CSA49F】【XSY3317】card 博弈论 DP

    题目大意 不会博弈论的 yww 在和博弈论大师 yxq 玩一个游戏. 有 \(n\) 种卡牌,第 \(i\) 种卡牌有 \(b_i\) 张. yww 会先把所有 \(B=\sum_{i=1}^nb_i ...

  3. Spring Boot整合Elasticsearch

    Spring Boot整合Elasticsearch   Elasticsearch是一个全文搜索引擎,专门用于处理大型数据集.根据描述,自然而然使用它来存储和搜索应用程序日志.与Logstash和K ...

  4. JS学习笔记Day24

    一.闭包和函数 (一)什么是闭包函数 概念:简单说就是函数中嵌套函数,嵌套在这里面的函数叫做闭包函数,外面的函数叫做闭包环境 作用:通过闭包函数,可以访问到闭包函数所在局部作用域中的变量及参数 特点: ...

  5. PLSQL Developer安装与配置

    前言 PLSQL Developer软件以及需要的配置 链接:https://pan.baidu.com/s/1xHdAl1RAgtQb-oDHPah19w 密码:x41k 1 安装 解压这两个压缩包 ...

  6. SEO基础内容

     学习SEO人群 网络设计师 网站站长 搜索引擎相关人员 网络营销顾问 企业主 搜索引擎 Yahoo msn google baidu SEM包括SEO,竞价排名等 搜索引擎爬虫流程 派出爬虫-> ...

  7. 备忘录模式-Memento Pattern(Java实现)

    备忘录模式-Memento Pattern Memento备忘录设计模式是一个保存另外一个对象内部状态拷贝的对象,这样以后就可以将该对象恢复到以前保存的状态. 本文中的场景: 有一款游戏可以随时存档, ...

  8. PMP知识点(二)——三点估算的两种方法对活动持续时间估算的影响和如何取舍

    一.准备工作 活动持续时间的估算属于PMBOK中第六章项目时间管理中第五节6.6估算活动持续时间的内容. 三点估算是6.5和7.2(估算成本)中应用到的一种工具和技术.数据流向图参考如下: 其应用到的 ...

  9. [译]Ocelot - Rate Limiting

    原文 Ocelot支持对上游做访问限流,这样就可以保证下游不要负载太大了. 如果要启用访问限流,需要做如下配置: "RateLimitOptions": { "Clien ...

  10. docker学习------registry可视化的实现

    1.Harbor的发现 之前一直在使用registry,但docker  pull下来的基础镜像并没用携带UI界面,所以查找了一波开源工具,发现了Harbor这一工具,下面对工具进行一个学习. 2.部 ...