docker 部署mysql连接问题
发现windows上有一个docker descktop(虽然不怎么好用), 安装之后准备直接用docker搭本地测试环境的基础设施(比如MySQL,Redis,MongoDB,ES啥的), 虽然比去到处找安装包安装来的好, 不过这样就体会不到自己装软件的乐趣了(滑稽.jpg)
首先是安装MySQL, 遇到了几个问题, 记录下
mysql镜像用的是最新版的, docker search mysql可以看大很多版本的, 我用的是第一个使用量最多那个(稳妥)
启动时未指定相关环境变量
docker desktop to specify one of the following:
- -MYSQL_ROOT_PASSWORD
- -MYSQL_ALLOW_EMPTY_PASSWORD
- -MYSQL_RANDOM_ROOT_PASSWORD
docker run -dit --restart always --name mysql-docker -e MYSQL_RANDOM_ROOT_PASSWORD=your-password -e MYSQL_ALLOW_EMPTY_PASSWORD=TRUE-e MYSQL_ROOT_PASSWORD=your-password -p 3308:3306 mysql
查看mysql启动时生成的密码

通过密码连接mysql
Public Key Retrieval is not allowed异常
连接时需要设置SSL, docker中的mysql镜像在运行过程中默认开启了SSL
启动日志
2021-07-28 01:31:54+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.26-1debian10 started.
2021-07-28 01:31:54+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2021-07-28 01:31:54+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.26-1debian10 started.
2021-07-28 01:31:54+00:00 [Note] [Entrypoint]: Initializing database files
2021-07-28T01:31:54.823283Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.26) initializing of server in progress as process 43
2021-07-28T01:31:54.834337Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-07-28T01:31:55.703399Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-07-28T01:31:58.007570Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
2021-07-28T01:31:58.008365Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
2021-07-28T01:31:58.079942Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2021-07-28 01:32:03+00:00 [Note] [Entrypoint]: Database files initialized
2021-07-28 01:32:03+00:00 [Note] [Entrypoint]: Starting temporary server
mysqld will log errors to /var/lib/mysql/04c2f13e03d1.err
mysqld is running as pid 94
2021-07-28 01:32:03+00:00 [Note] [Entrypoint]: Temporary server started.
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
2021-07-28 01:32:07+00:00 [Note] [Entrypoint]: GENERATED ROOT PASSWORD: at8Tunah6phudongieworerufaishaih
2021-07-28 01:32:07+00:00 [Note] [Entrypoint]: Stopping temporary server
2021-07-28 01:32:09+00:00 [Note] [Entrypoint]: Temporary server stopped
2021-07-28 01:32:09+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.
2021-07-28T01:32:09.511023Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.26) starting as process 1
2021-07-28T01:32:09.523510Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-07-28T01:32:09.718660Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-07-28T01:32:09.914244Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
2021-07-28T01:32:09.914533Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
2021-07-28T01:32:09.916163Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2021-07-28T01:32:09.916535Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2021-07-28T01:32:09.922148Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2021-07-28T01:32:09.943246Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2021-07-28T01:32:09.943351Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.26' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.
mbind: Operation not permitted
mbind: Operation not permitted
docker 部署mysql连接问题的更多相关文章
- docker部署mysql Navicat远程连接
docker部署mysql Navicat远程连接 docker search mysql 查看mysql镜像(是去dockerHub网站搜素镜像,遇到问题可以去该网站查看官方文档,纯英文文档估计 ...
- Docker 部署mysql
目录 Docker 部署mysql 步骤 1.查找 Docker Hub 上的 MySQL 镜像 2.docker pull mysql 拉取镜像 3.运行容器 4.查看容器启动情况 使用命令备注 D ...
- docker(部署常见应用):docker部署mysql
上节回顾:docker(部署常见应用):docker部署nginx docker部署mysql:5.7.26 # 下载镜像 docker pull mysql: # 查看镜像 docker image ...
- Docker:Docker部署mysql数据库
docker部署mysql : 8.0 1.在宿主机创建mysql挂载目录 #创建目录 mkdir /home/mysql/conf mkdir /home/mysql/logs mkdir /hom ...
- springboot多数据源配合docker部署mysql主从实现读写分离
本篇主要有两部分: 1.使用docker部署mysql主从 实现主从复制 2.springboot项目多数据源配置,实现读写分离 一.使用docker部署mysql主从 实现主从复制 此次使用的是wi ...
- Docker部署mysql 5.7
Docker部署mysql 5.7 准备工作 在CentOS或者Linux创建部署目录,用于存放容器的配置和MySQL数据:目的是当重装或者升级容器时,配置文件和数据不会丢失.执行以下命令: a.创建 ...
- Centos7借助docker部署mysql,提供远程链接服务
Centos7 借助docker部署mysql,并提供远程连接服务 安装docker 运行docker 注意安装docker和运行docker的步骤很简单,可以参考我学习docker的笔记 docke ...
- docker 部署mysql tomcat时 在root@localhost~下——-——docker exec -it 容器名 /bin/bash 报错
在docker部署mysql时 报错 找不到 容器不自动启动 , docker start 容器名 也没有效果 多次尝试发现 原因是创建容器时在 下面创建的 更改为下创建 问题解决
- docker部署mysql远程连接 解决1251 client does not support ..
现象:用虚拟机上Docker启动mysql之后无法在本地安装的navicat上远程连接已启动的mysql,错误截图: 原因:mysql 8.0 默认使用 caching_sha2_password 身 ...
随机推荐
- leetcode第157场周赛5213
当时居然没想到,我真菜,就当记录一下了. 思路分析: 分为两种: 第一种:走两步的,无论是奇或偶的位置,只要走两步,代价为0: 第二种:走一步的,就是偶数到奇数,或者奇数到偶数,代价为1: 那么实际上 ...
- leetcode第156场周赛5205
思路分析:先用哈希表统计各个数字的次数,再将每个值放进set集合中,之后如果有重复得,说明比原个数少了,如果都是独一无二的,那么个数是相同的 这波把collection集合,强转成set是真的灵性.想 ...
- ROS踩坑笔记总结
2019-07-12 11:32:16 我的第一篇原创博客(当然是站在巨人肩膀上,有些内容参考了其他大神的博客,都一一做了说明),这些是我之前在学习ROS期间经历的一些坑,以及相对应的解决方案,希望可 ...
- Mongo基于Java基本操作
1.使用Maven依赖相应jar <dependency> <groupId>org.mongodb</groupId> <artifactId>mon ...
- C语言:宏定义 本质及体现
- 短信链接点击跳转到微信小程序
短信轰炸的时代,之前链接都是跳转到网页的,后来发现粘性不强,再次唤醒用户成本较高,但小程序的订阅功能,再次唤醒成本较低,还便于给用户通知结果.所以现在链接都改跳转到小程序了.废话不多说,现在就看看是如 ...
- final修饰符(4)-"宏替换"
对于一个final变量来说,不管它时类变量,实例变量还是局部变量,只要满足三个条件,这个final变量就不再是一个变量,而是一个直接量.final变量的一个重要用途,就是定义"宏变量&quo ...
- shell脚本(3)-格式化输出
一个程序需要有0个或以上的输入,一个或更多输出 一.echo语法 1.功能:将内容输出到默认显示设备. echo命令功能在显示器上显示一段文字,一般提到提示的作用 2.语法:echo[-ne][字符串 ...
- C标准库学习
前言 C标准库源码可通过下列两个网站进行查看:The GNU C Library.Welcome to uClibc-ng! - Embedded C library 以下学习记录也是以这两个网站提供 ...
- Skywalking-02:如何写一个Skywalking trace插件
如何写一个Skywalking trace插件 javaagent 原理 美团技术团队-Java 动态调试技术原理及实践 类图 实现 ConsumeMessageConcurrentlyInstrum ...