become who you want to|

张三Blog

园龄:3年4个月粉丝:3关注:0

Docker 安装 Mysql 报错(2059) Authentication plugin ‘caching_sha2_password‘ 解决方案

1 .docker 安装mysql

# 下载mysql镜像
1. docker pull mysql:latest
# 启动mysql
2. docker run -p 3306:3306 --name mysqltest -e MYSQL_ROOT_PASSWORD=root -d mysql
#进入容器内部
3.docker exec -it mysqltest bash
4.容器内部> mysql -u root -p


进行测试 

2. 连接报错 (2059) Authentication plugin ‘caching_sha2_password’

在这里插入图片描述
解决方案

  • ALTER USER ‘root’ IDENTIFIED WITH mysql_native_password BY ‘root’
root@eccee808c07d:/etc/mysql# mysql  --user=root  --password   
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.27 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> ALTER  USER  'root'  IDENTIFIED  WITH  mysql_native_password  BY  'root'
    -> ;
Query OK, 0 rows affected (0.00 sec)

mysql> exit

即可完美解决

本文作者:张三Blog

本文链接:https://www.cnblogs.com/zhangsan-plus/p/16503254.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   张三Blog  阅读(80)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起