侯体宗的博客
  • 首页
  • Hyperf版
  • beego仿版
  • 人生(杂谈)
  • 技术
  • 关于我
  • 更多分类
    • 文件下载
    • 文字修仙
    • 群聊
    • 九宫格抽奖
    • 拼图
    • 消消乐
    • 相册

windows10中docker desktop安装使用mysql服务流程步骤

Docker  /  管理员 发布于 1星期前   116

windows10+docker环境作为开发测试环境还是非常方便的,下面介绍一下在该环境下mysql服务安装使用的流程步骤。

拉取最新的mysql镜像

C:\Users\htz>docker pull mysql
Using default tag: latest
latest: Pulling from library/mysql
32c1bf40aba1: Pull complete
3ac22f3a638d: Pull complete
b1e7273ed05e: Pull complete
20be45a0c6ab: Pull complete
410a229693ff: Pull complete
1ce71e3a9b88: Pull complete
c93c823af05b: Pull complete
c6752c4d09c7: Pull complete
d7f2cfe3efcb: Pull complete
916f32cb0394: Pull complete
0d62a5f9a14f: Pull complete
Digest: sha256:ce2ae3bd3e9f001435c4671cf073d1d5ae55d138b16927268474fc54ba09ed79
Status: Downloaded newer image for mysql:latest
docker.io/library/mysql:latest


查看镜像

C:\Users\htz>docker images
REPOSITORY   TAG       IMAGE ID       CREATED        SIZE
mysql        latest    7b94cda7ffc7   32 hours ago   446MB
nginx        latest    605c77e624dd   7 months ago   141MB


启动容器

C:\Users\htz>docker run -itd --name mysql-server -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql
626d1e27cb134103a20d2b3004f22075ab6b646726480dfb775d9c2e34346cc6

ps:

-p 3306:3306 :映射容器服务的 3306 端口到宿主机的 3306 端口,外部主机可以直接通过 宿主机  ip:3306 访问到 MySQL 的服务;

MYSQL_ROOT_PASSWORD=123456:设置 MySQL 服务 root 用户的密码;

mysql-server:表示启动的容器名称,这个名称可以自定义


查看运行的容器

C:\Users\htz>docker ps -a
CONTAINER ID   IMAGE     COMMAND                  CREATED       STATUS       PORTS                               NAMES
626d1e27cb13   mysql     "docker-entrypoint.s…"   2 hours ago   Up 2 hours   0.0.0.0:3306->3306/tcp, 33060/tcp   mysql-server

这样就ok了


用navicat测试连接一下

1.png



  • 上一条:
    redis中INCR、SETNX、SET三种加锁方式详解
    下一条:
    构建你自己的Laravel扩展包的流程步骤
  • 昵称:

    邮箱:

    0条评论 (评论内容有缓存机制,请悉知!)
    最新最热
    • 分类目录
    • 人生(杂谈)
    • 技术
    • linux
    • Java
    • php
    • 框架(架构)
    • 前端
    • ThinkPHP
    • 数据库
    • 微信(小程序)
    • Laravel
    • Redis
    • Docker
    • Go
    • swoole
    • Windows
    • Python
    • 苹果(mac/ios)
    • 相关文章
    • windows10+docker desktop使用docker compose编排多容器构建dnmp环境(0个评论)
    • windows10+docker desktop运行laravel项目报错:could not find driver...(0个评论)
    • windows10+docker desktop报错:docker: Error response from daemon: user declined directory sharing(0个评论)
    • windows10中docker desktop安装使用php+nginx服务流程步骤(0个评论)
    • windows10中docker desktop安装使用redis服务流程步骤(0个评论)
    • 近期文章
    • GnuPG(GPG)生成用于替代SSH密钥的子密钥:签名、加密、鉴权及SSH验证(0个评论)
    • GnuPG(GPG)密钥创建的流程步骤(0个评论)
    • Laravel 9.24版本发布(0个评论)
    • windows系统phpstudy环境中安装amqp拓展流程步骤(0个评论)
    • windows10+docker desktop使用docker compose编排多容器构建dnmp环境(0个评论)
    • windows10+docker desktop运行laravel项目报错:could not find driver...(0个评论)
    • windows10+docker desktop报错:docker: Error response from daemon: user declined directory sharing(0个评论)
    • go语言中Pat多路复用器路由功能示例代码(0个评论)
    • go语言中HttpRouter多路复用器路由功能示例代码(0个评论)
    • js中使用Push.js通知库将通知推送到浏览器(0个评论)
    • 近期评论
    • nkt 在

      阿里云香港服务器搭建自用vpn:Shadowsocks使用流程步骤中评论 用了三分钟就被禁了,直接阿里云服务器22端口都禁了..
    • 熊丽 在

      安装docker + locust + boomer压测环境实现对接口的压测中评论 试试水..
    • 博主 在

      阿里云香港服务器搭建自用vpn:Shadowsocks使用流程步骤中评论 @test  也可能是国内大环境所至,也是好事,督促你该研究学习新技术..
    • test 在

      阿里云香港服务器搭建自用vpn:Shadowsocks使用流程步骤中评论 打了一次网页,然后再也打不开了。。是阿里云的缘故吗?..
    • 博主 在

      centos7中Meili Search搜索引擎安装流程步骤中评论 @鹿   执行以下命令看看你的2.27版本是否存在strin..
    • 2017-11
    • 2020-06
    • 2021-05
    • 2021-08
    • 2021-09
    • 2021-10
    • 2021-11
    • 2021-12
    • 2022-01
    • 2022-02
    • 2022-03
    • 2022-07
    • 2022-08
    Top

    Copyright·© 2019 侯体宗版权所有· 粤ICP备20027696号 PHP交流群

    侯体宗的博客