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 身 ...
随机推荐
- 数据源连接数据库配置相关xml文件
学完数据源连接数据后,做个笔记,当我们的程序对数据库访问频繁时,为了提高程序运行效率,我们可以通过 数据源连接数据库,从数据库连接池中直接取得出于空闲状态的数据库连接对象,以下是相关xml文件的配置: ...
- buu [BJDCTF2020]easyrsa
下载附件是一个py文件,打开之后,发现是常规的rsa,不过有几个函数不知道. 这里记录一下, Fraction(a,b) 相当于 a/b Derivative(f(x),x) : 当x='x'时,f( ...
- get和post两种表单提交方式的区别
今天看到一篇博客谈论get和post区别,简单总结一下https://www.cnblogs.com/logsharing/p/8448446.html 要说两者的区别,接触过web开发的人基本上都能 ...
- layim即时通讯实例各功能整合
一.系统演示1.1 聊天窗体主界面演示 1.2 模拟两人在线聊天(点击图片查看演示视频) 1.3 在线演示> 在线演示,点击进入系统到这里,若是您想要的,接下来听我娓娓道来二.开发工具开发软件: ...
- python 函数定义自变量的写法及调用
import pandas as pd #函数定义时指明自变量,指明自变量的类型,指定自变量的默认值 #函数定义时,可以通过"自变量名称=常量"的方式指定自变量的默认值,调用时可以 ...
- C语言 c++区别
C语言是C89标准,C++是C++99标准的.C89就是在1989年制定的标准,如今最新的是C11和C++11标准.根据不同的标准,它们的功能也会有所不同,但是越新的版本支持的编译器越少
- final修饰符(4)-"宏替换"
对于一个final变量来说,不管它时类变量,实例变量还是局部变量,只要满足三个条件,这个final变量就不再是一个变量,而是一个直接量.final变量的一个重要用途,就是定义"宏变量&quo ...
- SLAM基础算法(1):卡尔曼滤波
对于一个正在运动中的小车来说,如何准确的知道它所处的位置? 理论家说:我可以通过牛顿公式来计算! 实践家说:给它装个GPS不就得了! 好吧,你们说的听上去都很有道理,但我们到底该相信谁? 现实情况是: ...
- Tbase读写分离与分库分表
一.读写分离 1.1 what 读写分离 读写分离,基本的原理是让主数据库处理事务性增.改.删操作(INSERT.UPDATE.DELETE),而从数据库处理SELECT查询操作.数据库复制被用来把事 ...
- SSM框架中mapper层,增删改查,如何实现
1.批量修改 <!-- 批量修改 MySQL--> <update id="updateBatch" parameterType="java.lang. ...