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. P1744 采购特价商品

    原题链接 https://www.luogu.org/problemnew/show/P1744 一道最短路的模板题.....很简单吧 求最短路的方法有很多,但是对于刚学完Floyd的我,只会用这个. ...

  2. 特殊计数序列——Catalan数

    Catalan数 前10项 \(1,1,2,5,14,42,132,429,1430,4862\) (注:从第\(0\)项起) 计算式 \(C_n=\frac{1}{n+1}\dbinom{2n}{n ...

  3. 什么是MIPI

        随着客户要求手机摄像头像素越来越高同时要求高的传输速度传统的并口传输越来越受到挑战.提高并口传输的输出时钟是一个办法但会导致系统的EMC设计变得越来困难,增加传输线的位数是但是这又不符合小型化 ...

  4. JSP中EL很常用,怎样使用大于号、小于号、等于号等

    JSP中EL很常用,怎样使用大于号.小于号.等于号等   符号 在EL中使用 常规 1 等于 eq == 2 不等于 ne != 3 大于 gt > 4 小于 lt < 5 大于等于 ge ...

  5. 第七周java学习总结

    学号 20175206 <Java程序设计>第七周学习总结 教材学习内容总结 第八章: 主要内容 String类 StringTokenizer类 Scanner类 StringBuffe ...

  6. vue-cli 项目踩坑 npm install 时出错

    1.报错如下: 2.此时你执行npm run dev  / npm run build 会报错如下 npm ERR! code ELIFECYCLEnpm ERR! errno 1npm ERR! v ...

  7. 理解依赖注入,laravel IoC容器

    在看laravel文档的时候,有一个服务容器(IoC)的概念.它是这样介绍的:Laravel 服务容器是一个用于管理类依赖和执行依赖注入的强大工具.依赖注入听上去很花哨,其实质是通过构造函数或者某些情 ...

  8. idea代码出现Usage of API documented as @since 1.8+ less... (Ctrl+F1)

    问题: Usage of API documented as @since 1.8+ less... (Ctrl+F1) This inspection finds all usages of met ...

  9. cocos2d-x入门学习笔记——Hello world分析

    Hello world分析 1. “resource”文件夹 用于存放图片.音频和配置等资源文件.为了方便管理,可以创建在其中创建子文件夹.Cocos2d-x为我们屏蔽了不同平台对于文件路径的定义. ...

  10. R语言数据集的技术

    特征值选择技术要点 特征值选择技术要点(特征值分解) 作者:王立敏 文章来源:xiahouzuoxin 一.特征值分解 1.特征值分解 线性代数中,特征分解(Eigendecomposition),又 ...