前提:

  安装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. SecondaryNameNode合并元信息过程

  2. [BJWC2011]禁忌 AC 自动机 概率与期望

    #include<cstdio> #include<algorithm> #include<cstring> #include<string> #inc ...

  3. 冒泡排序php

    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <b ...

  4. js实现观察者模式风格替换

    如下图,我们看到两种风格:在选择男士时,页面颜色为黑色:在选择女士时,页面颜色为粉红色. 主要可以分为两类: 下拉框 ---> 被观察者 div ---> 观察者 面向过程实现风格替换: ...

  5. 20180929 北京大学 人工智能实践:Tensorflow笔记03

    更改的程序部分如下: 另: 难?????????????见链接: https://www.bilibili.com/video/av22530538/?p=17 + (完)

  6. python ORM理解、元类

    元类 参考链接:https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/00143191 ...

  7. 第五讲 自对偶的Yang-Mills方程及Polyakov和t'Hooft解

    $\newcommand{\R}{\mathbb{R}}$以下我们考虑的是$\R^4$或者$S^4$上的Yang-Mills泛函,它们是共形不变的. 一.自对偶和反自对偶 我们寻找$\R^4$或$S^ ...

  8. 【习题 8-18 UVA - 1619】Feel Good

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 用单调队列求出l[i]和r[i] 分别表示i的左边最近的大于a[i]的数的位置以及i右边最近的大于a[i]的数的位置. 则l[i]+ ...

  9. [Python] Pandas load DataFrames

    Create an empty Data frame with date index: import pandas as pd def test_run(): start_date='2017-11- ...

  10. Codeforces 327A-Flipping Game(暴力枚举)

    A. Flipping Game time limit per test 1 second memory limit per test 256 megabytes input standard inp ...