之前一直用mysql5.6 远程授权登录,后来换mysql8.0原来的授权方式报错

mysql> grant all privileges on *.*  to  'root'@'%'  identified by 'root'  with grant option;
ERROR 1064 (42000): 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 'root' with grant option' at line 1
mysql> create user 'brady'@'%' identified by 'brady';
Query OK, 0 rows affected (0.02 sec)

8.0授权方式不一样

不能授权给自己

root@a21073c9b9f7:/# mysql -uroot -p
mysql: [Warning] World-writable config file '/etc/mysql/conf.d/mysql.cnf' is ignored.
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.13 MySQL Community Server - GPL Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
ERROR 1064 (42000): 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 'root' with grant option' at line 1

先创建一个其他用户

mysql> create user 'brady'@'%' identified by 'brady';
Query OK, 0 rows affected (0.02 sec) mysql>
mysql>
mysql> grant all privileges on *.* to 'brady'@'%' identified by 'brady' with grant option;
ERROR 1064 (42000): 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 'brady' with grant option' at line 1
mysql> GRANT ALL PRIVILEGES ON *.* TO 'brady'@'%';
Query OK, 0 rows affected (0.04 sec) mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec) mysql> ALTER USER 'brady'@'%' IDENTIFIED WITH mysql_native_password BY 'brady';
Query OK, 0 rows affected (0.02 sec) mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
如果用Navicat连接的回报不支持caching_sha2_password验证方式的错误。

将远程访问用户的验证方式改为: msyql_native_password 

执行:

ALTER USER 'username'@'%' IDENTIFIED WITH mysql_native_password BY 'password';

FLUSH PRIVILEGES;

mysql8.0授权远程登录的更多相关文章

  1. MySQL 授权远程登录(Ubuntu 环境)

    环境:Ubuntu 13.10 (GNU/Linux 3.11.0-12-generic i686) 在用 Navicat 连接远程数据库时报错: ERROR (HY000): Host *** is ...

  2. Mysql8.0 创建远程登陆账户

    mysql8和原来的版本有点不一样,8的安全级别更高,所以在创建远程连接用户的时候, 不能用原来的命令(同时创建用户和赋权): mysql>grant all PRIVILEGES on *.* ...

  3. ubantu18.04中mysql8.0设置远程连接的问题

    在mysql8.0中的配置文件中默认是没有绑定地址的,但是可以自己配置,在my.cnf中 这里使用另一种方式: 首先先连接到自己的数据库执行: use mysql; select host,user ...

  4. [mysql]增加用户 授权 远程登录

    mysql创建用户和授权 1.创建用户: (注意:下面的指令,请在root用户下输入) CREATE USER "用户名" IDENTIFIED BY "密码" ...

  5. 数据库相关--mysql8.0设置root登录密码

    系统:win7  64位 MySQL    8.0 .11 1.启动服务: $ net start mysql 进入MySQL(mysql -hlocalhost -uroot): 2.选择mysql ...

  6. mysql8.x开启远程登录

    mysql8.x密码的认证方式变了,需要修改远程认证方式 问题描述 Connection to lab-130-mysql failed.Unable to load authentication p ...

  7. Ubuntu 18.04 启动root账号并授权远程登录

    Ubuntu 18.04 刚刚上市2个月,下载安装,尝尝鲜~ 安装界面看上去舒服许多, 安装的速度也较之前17.04 和16.04 都快了许多.抱歉,未截图. Ubuntu 安装完成后默认不启动roo ...

  8. Mysql授权远程登录

    在命令行输入如下命令即可: Grant all privileges on *.* to ' with grant option; 再执行 flush privileges

  9. Navicat连接远程MySQL8.0数据库

    前言: 如果你有一台服务器,并且安装了Mysql8.0及以上版本数据库.此时想通过本地Navicat软件连接远程服务器上的mysql数据库.那么接下来你就要完成以下准备工作: 登录远程服务器上的数据库 ...

随机推荐

  1. Spring Cloud微服务安全实战-1-1 课程导学

  2. break 和 continue 的用法

    break 是结束循环 continue 是结束本次循环,接下下一个循环

  3. CA认证以及https的实现

    (1).CA认证 CA全称Certificate Authority,通常翻译成认证权威或者认证中心,主要用途是为用户发放数字证书.认证中心(CA)的功能:证书发放.证书更新.证书撤销和证书验证.CA ...

  4. Elasticsearch服务器开发(第2版).pdf 含目录

    Elasticsearch服务器开发(第2版) 介绍: <Elasticsearch服务器开发(第2版)>这一版针对Elasticsearch的新版本更新了内容,增加了第1版中遗漏的重要内 ...

  5. IDEA 多模块工程相互依赖

    最近为了结构项目,抽离通用模块,同时使用一个工程管理所有模块,使用了多模块工程.不过在依赖其他模块的编译上出现了问题,总是报找不到被依赖的jar包. 最后的解决办法也很简单,对于被依赖的模块,要在ma ...

  6. 使用wkhtmltopdf将多个html批量转成pdf

    相关工具:wkhtmltopdf 场景:比如笔者有 ognl中文文档,全部是html,现在想把它转成pdf,放到ipad阅读,文件如下: 下载好wkhtmltox(本地安装目录 D:\develop\ ...

  7. 【C# 开发技巧】 c#窗体关于调试界面和运行界面不一样的原因之一

    如下图所示: 原因是因为主窗体属性AutoScaleMode设置为:Font了: 按自己需求将AutoScaleMode设置修改即可. 另外一个可能是系统显示-缩放与布局-要调整到100% 如下图:

  8. JIRA中的并联审批流程定制

    JIRA号称可以跟踪任何事务,让JIRA的流程来匹配团队的工作流程,而不是让你的团队适应JIRA的工作流程.但是在实践中,有些有些流程用JIRA还是比较困难的,比如并联审批流程,一个并联审批流程需求大 ...

  9. Eclipse 常用配置和基本调试

    常用配置 1.显示行号:window->Preferences->General->Editors->Text Editors , 勾选show line numbers 2. ...

  10. mysql 库、表、数据的增删改

    数据库定义 语法形式 (1)创建数据库 create database [if not exists ] 数据库名 [charset 字符集] [collate 字符排序规则]; if not exi ...