Docker学习笔记之操作mysql
发布日期:2021-06-22 10:30:57
浏览次数:7
分类:技术文章
本文共 1043 字,大约阅读时间需要 3 分钟。
背景
记录下如何使用docker容器操作mysql数据库
方法
1、下载镜像
$ docker pull mysql:5.6
2、运行容器
$ docker run -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root mysql:5.6
-e指定环境变量
3、进入容器
C:\Users\songzeceng>docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES699ed4931f3e mysql:5.6 "docker-entrypoint.s…" 13 seconds ago Up 7 seconds 0.0.0.0:3306->3306/tcp pensive_brattainC:\Users\songzeceng>docker exec -it 699ed4931f3e /bin/bashroot@699ed4931f3e:/#
4、运行Mysql,输入密码root
root@699ed4931f3e:/# mysql -uroot -pEnter password:Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.6.47 MySQL Community Server (GPL)Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>
转载地址:https://blog.csdn.net/qq_37475168/article/details/105028913 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
初次前来,多多关照!
[***.217.46.12]2024年04月04日 20时18分43秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
用 C 语言开发一门编程语言 — 变量元素设计
2019-04-27
Linux 操作系统原理 — 文件系统 — 虚拟文件系统
2019-04-27
Kubernetes — 生产环境架构简述
2019-04-27
Kong APIGW — Overview
2019-04-27
FD.io/VPP — QoS — DPDK Hqos
2019-04-27
Kubernetes — Kubespray 开箱即用的部署工具
2019-04-27
Ansible — Inventory 清单文件
2019-04-27
CentOS7 通过 YUM 升级 VIM8
2019-04-27
Python3 configparser模块的安装、基础读写ini文件和字典的互转
2019-04-27
A. Donut Shops(分类模拟)
2019-04-27
C. Maximal Intersection(贪心)
2019-04-27
JS简单应用... Jquery 作一个抽奖(老婆)机~
2019-04-27
CF1457 D. XOR-gun(猜结论题)
2019-04-27
2021牛客寒假算法基础集训营1 红和蓝(二分图染色)
2019-04-27
P3825 [NOI2017] 游戏(构造2-SAT模型)
2019-04-27
2019牛客国庆集训派对day2 J.Vertex Cover(思维,组合数学算贡献)
2019-04-27
PyPI的注册与模块发布
2019-04-27
Qt工作笔记-列表的分页显示(Qt Widgets框架)
2019-04-27