`
gaojingsong
  • 浏览: 1204945 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
文章分类
社区版块
存档分类
最新评论

Docker之中mysql链接报错

 
阅读更多
Client does not support authentication protocol requested by server; 
consider upgrading MySQL client

[root@node1 gaojs]# cat start 
#!/bin/bash

docker run --name mysqldb -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql
[root@node1 gaojs]# mv start  docker_mysql
[root@node1 gaojs]# clear
[root@node1 gaojs]# chmod 777 docker_mysql 
[root@node1 gaojs]# clear
[root@node1 gaojs]# ls
apache-hive-2.3.9-bin.tar.gz  docker_mysql  Downloads    hadoop-2.8.1.tar.gz  jdk-linux-x64.tar.gz  Pictures  Templates
Desktop                       Documents     hadoop2.8.1  jdk1.8.0_131         Music                 Public    Videos
[root@node1 gaojs]# sh docker_mysql 
385d2e8747de4e07827c571f9605c579d028207c944c723b288b190bd3ad1c01
[root@node1 gaojs]# docker ps  -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                               NAMES
385d2e8747de        mysql               "docker-entrypoint..."   7 minutes ago       Up 7 minutes        0.0.0.0:3306->3306/tcp, 33060/tcp   mysqldb
[root@node1 gaojs]# docker exec -it 385d2e8747de /bin/bash  
root@385d2e8747de:/# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 8.0.25 MySQL Community Server - GPL

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

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> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select host,user from user;
+-----------+------------------+
| host      | user             |
+-----------+------------------+
| %         | root             |
| localhost | mysql.infoschema |
| localhost | mysql.session    |
| localhost | mysql.sys        |
| localhost | root             |
+-----------+------------------+
5 rows in set (0.05 sec)

mysql> select host,user,plugin,authentication_string from mysql.user;
+-----------+------------------+-----------------------+------------------------------------------------------------------------+
| host      | user             | plugin                | authentication_string                                                  |
+-----------+------------------+-----------------------+------------------------------------------------------------------------+
| %         | root             | caching_sha2_password | $A$005$wTf<wF
NIQr)wjC\DEQQjjFLBE/0cxRp.d//.S9Tel.qsQUe9bW5KPqx8k. |
| 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$e.+czYXFnFqm xrFumAQrIMlZayXjJJQvJSlexMsEjw2fK7EljgXSwO6 |
+-----------+------------------+-----------------------+------------------------------------------------------------------------+
5 rows in set (0.09 sec)

mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456'; 
Query OK, 0 rows affected (0.06 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.03 sec)

mysql> 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics