docker deployment mysql remote connectivity solutions 1251 client does not support ..

Phenomenon: a virtual machine after Docker mysql start mysql can not be installed locally on navicat remote connection is activated, the error screenshots:

The reason: MySQL 8.0 using the default authentication mechanism caching_sha2_password; client does not support the new encryption method.

solution:

Modifying user (root) encryption method

step:
1, into the interior of the container mysql
[root@localhost ~]# docker exec -it mysql01 bash

Enter the following command after entering:

root@8e74f086c2bb:/# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.16 MySQL Community Server - GPL

Copyright (c) 2000, 2019, 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.

And you will be prompted to enter the mysql container: enter the corresponding command

mysql> select host,user,plugin,authentication_string from mysql.user;
+-----------+------------------+-----------------------+------------------------------------------------------------------------+
| host      | user             | plugin                | authentication_string                                                  |
+-----------+------------------+-----------------------+------------------------------------------------------------------------+
| %         | root             | caching_sha2_password | $A$005$Z%@a}aqP.mjjK<t?SjMyCAGpzJJtUmnYFmTgPoqWOESUfAg9ojwPkd8HzP4 |
| localhost | mysql.infoschema | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| localhost | mysql.session    | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| localhost | mysql.sys        | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| localhost | root             | caching_sha2_password | $A$005$Gr/wA/
                                                                      PHFFzz``OkyuNlZo3K6eObfcdOORjQoG3zvTztdSnkIDOgg5ZkmzRb/ |
+-----------+------------------+-----------------------+------------------------------------------------------------------------+
5 rows in set (0.00 sec)

% host is not to limit use of the machine represented ip localhost plugin will need to modify the password non mysql_native_password

Enter the following command:

mysql>ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
mysql>flush privileges;

Query again:

mysql> select host,user,plugin,authentication_string from mysql.user;
+-----------+------------------+-----------------------+------------------------------------------------------------------------+
| host      | user             | plugin                | authentication_string                                                  |
+-----------+------------------+-----------------------+------------------------------------------------------------------------+
| %         | root             | mysql_native_password | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9                              |
| localhost | mysql.infoschema | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| localhost | mysql.session    | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| localhost | mysql.sys        | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| localhost | root             | caching_sha2_password | $A$005$Gr/wA/
                                                                      PHFFzz``OkyuNlZo3K6eObfcdOORjQoG3zvTztdSnkIDOgg5ZkmzRb/ |
+-----------+------------------+-----------------------+------------------------------------------------------------------------+
5 rows in set (0.00 sec)

Has been editing, click on the link:

 

Guess you like

Origin www.cnblogs.com/bobkingblog/p/11070062.html