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. jquery 设置 transform/translate 获取 transform/translate 的值

    //获取 transform 值 var reg=/matrix.(((-)?([0-9]+.)?\d+([, ]+)?){6})./g; var str= progressUI.css(" ...

  2. MT【330】u,v,w法

    已知$a^2+b^2+c^2=1$求$abc(a+b+c)$的最小值.(2018辽宁预赛解答压轴题) 不妨设$a+b+c=3u,ab+bc+ca=3v^2,abc=w^3$,令$u^2=tv^2$要求 ...

  3. springMVC统一异常处理

    Spring MVC处理异常有3种方式: 使用Spring MVC提供的简单异常处理器SimpleMappingExceptionResolver: 实现Spring的异常处理接口HandlerExc ...

  4. Golang语言的入门开始

    一.golang介绍与安装 二.golang-hello world 三.golang的变量 四.golang的类型 五.golang的常量 六.golang的函数(func) 七.golang的包 ...

  5. java的集合:List、Set和Map

    虚线是接口,实线是实现类: 集合能够解决的问题:集合可以丽杰为是一种更高级的数组,可以保存多条数据 本质:java官方开发人员基于java的一些基础内容(数组等等)创建了一些接口和类,然后使用这些接口 ...

  6. lumen 支持多文件上传

    1.webform (注意:name后面一定要加[]号) <form method="post" enctype="multipart/form-data" ...

  7. SNMP mib文件说明

    MIB file的开始和结束 所有的MIB file的都以DEFINITIONS ::= BEGIN关键字开始,以END结束.我们所有添加的节点均应在此之间. XXX-TEST-MIB DEFINIT ...

  8. WebApi系列(从.Net FrameWork 到 .Net Core)

    一. 简介  1. 什么是WebApi? WebApi是一个很广泛的概念,在这里我们特指.Net平台下的Asp.Net WebApi框架,它是针对各种客户端(浏览器.APP等)来构建Http服务的一个 ...

  9. SVN的安装与使用教程

    转载:http://www.cnblogs.com/armyfai/p/3985660.html SVN简介: 为什么要使用SVN? 程序员在编写程序的过程中,每个程序员都会生成很多不同的版本,这就需 ...

  10. Java(13) 抽象和封装

    一.简述从现实世界中抽象出类的步骤 第一:找出分类(分析出类) 第二:找出类的特征(分析类的相关属性) 第三:找出类的行为(分析类的方法) 二.常量(经常出现的变量值) 2.1 语法: public ...