当前位置:网站首页>【5】Docker中部署MySQL
【5】Docker中部署MySQL
2022-08-05 05:26:00 【技术的搬运工】
1)拉取 mysql 镜像
docker pull mysql:8.0
2)创建容器
docker run -di --name=mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root mysql:8.0
![]()
mysql 操作的一些命令:
service mysqld status # 查看 mysql 服务状态
service mysqld stop # 关闭 mysql 服务
service mysqld start # 开启 mysql 服务
关闭 mysql 服务

关闭宿主机的mysql服务后,删除之前创建的mysql容器,重新再创建并 设置 登陆密码为 123456

查看容器,发现 mysql 容器创建成功了,并且是启动和在线的状态

3)远程登陆 mysql
docker exec -it mysql /bin/bash # (连接宿主机的IP,指定端口为 3306)
登陆到 mysql 容器中
4)使用 mysql 命令打开客户端
mysql -u root -p 123456 --default-character-set=utf8 # --default-character-set=utf8 设置mysql默认的编码格式为 utf8
连接 mysql (这里的操作就跟平时语句操作mysql一样了)

5)连接 mysql 数据库

边栏推荐
- [issue resolved] - jenkins pipeline checkout timeout
- Some basic method records of commonly used languages in LeetCode
- selenium学习
- The cocos interview answers you are looking for are all here!
- LeetCode刷题记录(2)
- 深入分析若依数据权限@datascope (注解+AOP+动态sql拼接) 【循序渐进,附分析过程】
- Collision, character controller, Cloth components (cloth), joints in the Unity physics engine
- 数组&的运算
- Writing OpenCV in VSCode
- System basics - study notes (some command records)
猜你喜欢

摆脱极域软件的限制

DevOps流程demo(实操记录)

前置++和后置++的区别

Transformer interprets and predicts instance records in detail

盒子模型大详解

DevOps - Understanding Learning

Tencent Internal Technology: Evolution of Server Architecture of "The Legend of Xuanyuan"

获取预训练模型的网络输入尺寸

白鹭egret添加新页面教程,如何添加新页面

GetEnumerator method and MoveNext and Reset methods in Unity
随机推荐
LaTeX使用frame制作PPT图片没有标号
LeetCode刷题记录(2)
系统基础-学习笔记(一些命令记录)
Cloud Computing Basics - Study Notes
Quick Start to Drools Rule Engine (1)
In-depth analysis if according to data authority @datascope (annotation + AOP + dynamic sql splicing) [step by step, with analysis process]
邮件管理 过滤邮件
Error correction notes for the book Image Processing, Analysis and Machine Vision
Collection of error records (write down when you encounter them)
浏览器兼容汇总
深夜小酌,50道经典SQL题,真香~
What is Alibaba Cloud Express Beauty Station?
el-progress implements different colors of the progress bar
自营商城提高用户留存小技巧,商城对接小游戏分享
numpy.random usage documentation
What is the website ICP record?
LaTeX 图片加标题 文本分栏自动换行
云计算基础-学习笔记
BIO, NIO, AIO practical study notes (easy to understand theory)
NACOS配置中心设置配置文件