前提:

  安装MYSQL实例

docker pull mysql

  

  启动mysql(做了端口映射)

[root@localhost ~]# docker run -p 3306:3306 --name mysql02 -e MYSQL_ROOT_PASSWORD=123456 -d mysql
5cf11b6647da2f4d301020934cb8ef750d7215d3c25fb81a56d30fbfd1a24530

  

  言归正传:解决方案如下:

   在docker创建mysql容器后使用Navicat远程连接事报错:

  操作起来:

  先查看user表中的信息:

select host,user,plugin,authentication_string from mysql.user;  

  

host 列中的 % 表示不限制IP ; localhost表示的是本机使用   plugin非mysql_native_password 则需要修改密码

alter user 'root'@'% 'IDENTIFIED WITH mysql_native_password BY '123';
// (注意SQL语句最后加上 ;) //其中 root用户 密码为123 (按照你的用户 密码对应设置既可) //最后刷新生效 flush privileges;

  

[root@localhost ~]# docker run -it --link mysql02:mysql --rm mysql sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$M
YSQL_ENV_NYSQL_ROOT_PASSWORD"'
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.11 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> select host,user,plugin,authentication_string from mysql.user;
+-----------+------------------+-----------------------+------------------------------------------------------------------------+
| host | user | plugin | authentication_string |
+-----------+------------------+-----------------------+------------------------------------------------------------------------+
| % | root | caching_sha2_password | $A$005$*@A<}'C_C7%M4i3c3Qmow5Vpi7OWL0v..KqLCIzI5ai7tvBGkXxE7K6 |
| localhost | mysql.infoschema | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| localhost | mysql.session | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| localhost | mysql.sys | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| localhost | root | caching_sha2_password | $A$005$vU(<0Km/fNjY\IW8Ma8ktz5xLyByDbtiEVsGqaIa5B/JzXfuXe9ez0d15VC |
+-----------+------------------+-----------------------+------------------------------------------------------------------------+
5 rows in set (0.03 sec)
mysql> Alter user 'root'@'% 'IDENTIFIED WITH mysql_native_password BY '123';
Query OK, 0 rows affected (0.06 sec) mysql> flush privileges;

  

docker -mysql服务设置远程连接 解决1251 client does not support ..问题的更多相关文章

  1. mysql服务设置远程连接 解决1251 client does not support ..问题

    在docker里面创建mysql容器后设置的密码在远程主机连接时候出现错误: 一.如果是在docker里面安装的mysql镜像则需要先进入mysql里面:参考上一篇:https://www.cnblo ...

  2. docker部署mysql远程连接 解决1251 client does not support ..

    现象:用虚拟机上Docker启动mysql之后无法在本地安装的navicat上远程连接已启动的mysql,错误截图: 原因:mysql 8.0 默认使用 caching_sha2_password 身 ...

  3. mysql服务设置远程连接

    一.前期准备 1.虚拟机/物理机    mysql环境(非本机)2.本机 navicat软件(验证远程连接) 二 .mysql配置 1.在远程主机的本机   使用root用户连接mysql mysql ...

  4. linux下安装mysql并设置远程连接

    腾讯云环境为Centos7.4   mysql版本为5.6 本次安装使用yum安装 检查是否已有mysql: yum list installed | grep mysql 下载yum源文件: wge ...

  5. mysql数据库设置远程连接权限

    原文 问题现象 mysql 安装完毕,本机登录正常,在远程输入正确账号密码登录连接时报错如下 问题原因 远程IP没有登录权限,root用户默认只能在localhost也就是只能在本机登录,需要设置允许 ...

  6. MySQL数据库无法远程连接的解决办法

    远程登陆数据库的时候出现了下面出错信息: ERROR 2003 (HY000): Can't connect to MySQL server on 'xxx.xxx.xxx.xxx', 经过今天下午的 ...

  7. MySQL不支持远程连接的解决办法

    如果mysql不支持远程连接,会出现提示:错误代码是1130,ERROR 1130: Host * is not allowed to connect to this MySQL server ,解决 ...

  8. Mysql 修改密码和设置远程连接

    [参考文章]:mysql修改root密码和设置权限 1. 修改密码 1.1 set password 登录mysql set password for 用户名@localhost = password ...

  9. 安装好mysql后允许远程连接

    安装好mysql后允许远程连接 http://blog.sina.com.cn/s/blog_3eba8f1c0100tsox.html http://blog.csdn.net/zxyvb/arti ...

随机推荐

  1. Chrome插件开发笔记

    使用 XMLHttpRequest来抓取盗版小说网站里面的内容,但是注意需要在manifest.json文件中设置permission var xhr = new XMLHttpRequest();x ...

  2. 洛谷P3402 【模板】可持久化并查集

    一定注意每一次都要是 $root[cur]=root[cur-1]$,不然进行合并时如果 $a,b$ 在同一集合中就会使 $root[cur]=0$. Code: #include <cstdi ...

  3. [笔记-图论]Floyd

    用于可带负权的多源最短路 时间复杂度O(n^3) 注意一定不要给Floyd一个带负环的图,不然就没有什么意义了(最短路不存在) 模板 // Floyd // to get minumum distan ...

  4. [洛谷P1156][codevs1684]垃圾陷阱

    题目大意:一头奶牛掉进了深度为d的坑里,现在有g个垃圾在特定时刻ti扔进来.奶牛可以吃垃圾以获得体力,吃第i个垃圾能获得mi的体力,也可以堆放垃圾以逃生,第i个垃圾高度为hi.当高度≥d时奶牛成功逃生 ...

  5. VS2015使用过程中参考过的有用链接

    VS中的第一个C程序:如何在Visual Studio 2015中编写C程序:https://www.bilibili.com/video/av5921799?from=search&seid ...

  6. 【SRM 716 DIV 1 A】 ConstructLCS

    Problem Statement A string S is a subsequence of a string T if we can obtain S from T by erasing som ...

  7. ArcGIS api for javascript——1,2,3综合

    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"% ...

  8. How to test Heat (by quqi99)

    作者:张华  发表于:2015-12-19版权声明:能够随意转载.转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明 (http://blog.csdn.net/quqi99 ) Heat ...

  9. sp_executesql invalid object name

    https://stackoverflow.com/questions/10417126/dynamically-named-temp-table-returns-invalid-object-nam ...

  10. centos7 keepalive双机热备~

    简单实现Keepalive双击热备~ 摘要:准备两台虚拟机A:192.168.161.7  B:192.168.161.35  虚拟ip:192.168.161.10 keepalive进程 具体关于 ...