之前一直用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. .mmap文件如何打开

    .mmap是一种思维导图文件的后缀,可以用Xmind软件打开.

  2. Qt5.编译错误.error: C2338: The slot requires more arguments than the signal provides.

    1.Qt563x86vs2015,遇到如下 编译错误: error: C2338: The slot requires more arguments than the signal provides. ...

  3. 同时使用Redis缓存和Google Guava本地缓存注意事项(深拷贝和浅拷贝)

    目录 1.问题场景及说明 2.Redis 缓存是深拷贝 3.Guava本地缓存直接获取则是浅拷贝 4.如何实现Guava获取本地缓存是深拷贝? 1.问题场景及说明 系统中同时使用 Redis 缓存和 ...

  4. PHP 菠菜木马代码

    <?php error_reporting(E_ERROR);@ini_set('display_errors', 'Off');@ini_set('max_execution_time', 2 ...

  5. Quartz.Net—DateBuilder

    定时框架中最重要的就是时间,我们也可以直接使用Cron这种事件格式.  使用其他的时间格式,就可以用DateBuilder快速的创建出需要的时间. 因为quartz是一个定时框架,所以对于操控时间  ...

  6. 修改织梦DedeCMS投票漏洞

    织梦/dedecms系统我们都知道是有很多漏洞的,我在调试投票功能的时候正好要用到投票功能,这不就出现了漏洞,下面我就给大家展示如何修复这个织梦投票漏洞 首先我们打开//dedevote.class. ...

  7. 从零开始学Flask框架-002

    Jinja2模板 默认情况下,Flask 在程序文件夹中的templates 子文件夹中寻找模板. Jinja2 中的extends 指令从Flask-Bootstrap 中导入bootstrap/b ...

  8. 05 多继承、object类

    多继承 Python中一个类可以继承多个父类,并且获得全部父类的属性和方法. class A: def demo(self): print("demo") class B: def ...

  9. PAT(B) 1063 计算谱半径(Java)

    题目链接:1063 计算谱半径 (20 point(s)) 题目描述 在数学中,矩阵的"谱半径"是指其特征值的模集合的上确界.换言之,对于给定的 n 个复数空间的特征值 { a​1 ...

  10. chrome下载离线安装包

    chrome下载离线安装包 - codeflyto - 博客园 下载页面: