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'

最新文章

  1. hash简单介绍
  2. FAILED java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI:hdfs:192.*
  3. BootStrap网格布局
  4. JBOSS尝鲜
  5. [C++] WinAES问题
  6. javaWeb超链接(href)请求-特殊字符处理
  7. javascript使用闭包模拟私有属性和方法
  8. 高下相倾,前后相随——iterator 与 for ... of 循环
  9. ES7的async/await
  10. Centos7.5 安装VirtualBox增强工具
  11. HYSBZ 2743 (树状数组) 采花
  12. 20155320 2016-2017-2《Java程序设计》第八周学习总结
  13. LeetCode[Linked List]: Remove Duplicates from Sorted List II
  14. 《Robot Framework自动化测试修炼宝典》道长
  15. 移动端地区选择mobile-select-area插件的使用方法
  16. android自定义Activity窗口大小(theme运用)
  17. I.MX6 Linux U-boot 环境变量解析
  18. Js操作DOM及获取浏览器高度以及宽度
  19. Git的使用规范(一)
  20. Tomcat 5常用优化和配置

热门文章

  1. let 和 const 在for 循环中的使用
  2. git版本回退
  3. ImageMagick 安装 window10与错误总结
  4. [SMB share]Create SMB share under powershell / poweshell下创建本机的SMB共享
  5. jmeter笔记(8)--关联
  6. 在graphviz中创建可点击的图形
  7. Flexbox(弹性盒模型)完全指南
  8. (二叉树 递归) leetcode94. Binary Tree Inorder Traversal
  9. Springboot集成Quartz
  10. CNN 激活函数