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 身 ...
随机推荐
- Ubuntu命令总结
sudo apt-get update 系统更新 shutdown -h now 关闭服务器 shutdown -r now 重启服务器 uname -a ubuntu中查看内核版本的命令 gedit ...
- 「CF516D」 Drazil and Morning Exercise
「CF516D」 Drazil and Morning Exercise 传送门 这个 \(f_i\) 显然可以通过树形 \(\texttt{DP}\) 直接求. 然后看到这种差值问题感觉就可以二分转 ...
- c语言:putchar
函数:1.C语言是一门函数语言,由多个函数组成,至少有一个主函数.2.主函数的写法:下面四种写法都正确 main() main(void) int main() int main(void):int表 ...
- java集合(4)-Set集合
Set集合,类似于一个罐子,程序可以把多个对象"丢进"Set集合,而Set集合通常不能记住每个元素的添加顺序.Set集合与Collection基本相同,没有提供任何额外的方法.实际 ...
- CSAPP:bomblab
BOMBLAB实验总结 CSAPP实验BOMB,很头疼,看不懂,勉强做完了. 答案是这样的: Border relations with Canada have never been better. ...
- P2490 [SDOI2011]黑白棋
P2490 [SDOI2011]黑白棋 题意 一个 \(1*n\) 的棋盘上,A 可以移动白色棋子,B 可以移动黑色的棋子,其中白色不能往左,黑色不能往右.他们每次操作可以移动 1 到 \(d\) 个 ...
- 构建前端第12篇之---在Vue中对组件,变量,函数的全局引入
张燕涛写于2020-01-16 星期two 本篇还是源于import和export的使用,昨天看es6入门 和MDN文档,大体上用法了解了,但今天看ElementUI源码的时候,看到 //src/in ...
- vue点击复制功能
复制功能,选中复制或者点击复制(不使用插件的情况下) 1.选中复制 这个比点击复制简单点 <template> <div> <el-button type=& ...
- 网安日记③之通过iis搭建ftp并使用通过serv-u搭建ftp
通过iis搭建ftp并使用通过serv-u搭建ftp 安装iis的ftp访问 由于在安装iis时勾选了ftp服务,我们直接在iis界面右键ftp服务打开属性查看本地路径 在电脑目录下打开安装目录,并在 ...
- Mybatis学习笔记-CRUD
namespace namesapce中的包名需与Dao/Mapper接口的包名一致 SELCET 选择,查询语句 id:对应namespace中的方法: resultType:Sql语句执行的返回值 ...