之前一直用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. 泡泡一分钟:SceneCut: Joint Geometric and Object Segmentation for Indoor Scenes

    张宁    SceneCut: Joint Geometric and Object Segmentation for Indoor Scenes    "链接:https://pan.ba ...

  2. Spring Cloud Ribbon 客户端负载均衡 4.3

      在分布式架构中,服务器端负载均衡通常是由Nginx实现分发请求的,而客户端的同一个实例部署在多个应用上时,也需要实现负载均衡.那么Spring Cloud中是否提供了这种负载均衡的功能呢?答案是肯 ...

  3. Linux习题1

    1. GUN的含义是:     GNU's Not UNIX    . 2. Linux一般有3个主要部分:内核.命令解释层.实用工具. 3.POSIX是可携式操作系统接口的缩写,重点在规范核心与应用 ...

  4. 漏洞复现之Redis-rce

    通过主从复制 GetShell Redis主从复制 Redis是一个使用ANSI C编写的开源.支持网络.基于内存.可选持久性的键值对存储数据库.但如果当把数据存储在单个Redis的实例中,当读写体量 ...

  5. pytorch1.0实现RNN for Regression

    import torch from torch import nn import numpy as np import matplotlib.pyplot as plt # 超参数 # Hyper P ...

  6. [Oracle] - 关于星期(IW和WW)的算法

    1. 查看数据库字符集(如果字符集不同,可能显示乱码) select DECODE(parameter, 'NLS_TERRITORY', 'TERRITORY', 'NLS_LANGUAGE', ' ...

  7. 处理Oracle 监听文件listener.log

       如果连接时候变得较慢 查看Oracle日志记录,可能是因为此文件太大,超过2G, 需要定期清理,(如果多用户,记得用root,可能没权限) 查看listener.log? find / -nam ...

  8. 分布式自增ID算法snowflake

    分布式系统中,有一些需要使用全局唯一ID的场景,这种时候为了防止ID冲突可以使用36位的UUID,但是UUID有一些缺点,首先他相对比较长,另外UUID一般是无序的,作为索引非常不好,严重影响性能. ...

  9. JDBC预编译statement(preparedstatement)和statement的比较、execute与executeUpdate的区别

    和 Statement一样,PreparedStatement也是用来执行sql语句的与创建Statement不同的是,需要根据sql语句创建PreparedStatement除此之外,还能够通过设置 ...

  10. STL源码剖析——空间配置器Allocator#1 构造与析构

    以STL的运用角度而言,空间配置器是最不需要介绍的东西,因为它扮演的是幕后的角色,隐藏在一切容器的背后默默工作.但以STL的实现角度而言,最应该首先介绍的就是空间配置器,因为这是这是容器展开一切运作的 ...