首页  

docker 部署 MySQL     所属分类 docker 浏览量 244
docker run -d -p3306:3306 -eMYSQL_ROOT_PASSWORD=123456 mysql
-e 环境参数
最后的 mysql 是镜像名 
可指定版本  不写版本,默认 latest 版本
docker run -d -p3306:3306 -eMYSQL_ROOT_PASSWORD=123456 mysql:5.7

docker exec -it mysql mysql -uroot -p123456
-it mysql 指定容器名
启动时可指定容器名
docker run -d -p3306:3306 -eMYSQL_ROOT_PASSWORD=123456 -name mysql mysql

没有指定容器名 可以指定 容器id
docker ps
CONTAINER ID   IMAGE                           COMMAND                  CREATED         STATUS              PORTS                                                                      NAMES
486d1d044452   mysql:5.7                       "docker-entrypoint.s…"   2 minutes ago   Up About a minute   3306/tcp, 33060/tcp, 0.0.0.0:3307->3307/tcp                                youthful_goldberg
24bfb1aa8b78   mysql                           "docker-entrypoint.s…"   9 minutes ago   Up 9 minutes        0.0.0.0:3306->3306/tcp, 33060/tcp                                          nifty_grothendieck

docker exec -it 24bfb1aa8b78 mysql -uroot -p123456

mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.28 MySQL Community Server - GPL

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 




docker run -d -p3306:3306 -eMYSQL_ROOT_PASSWORD=123456 mysql Unable to find image 'mysql:latest' locally latest: Pulling from library/mysql 6552179c3509: Pull complete d69aa66e4482: Pull complete 3b19465b002b: Pull complete 7b0d0cfe99a1: Pull complete 9ccd5a5c8987: Pull complete 2dab00d7d232: Pull complete 5d726bac08ea: Pull complete 11bb049c7b94: Pull complete 7fcdd679c458: Pull complete 11585aaf4aad: Pull complete 5b5dc265cb1d: Pull complete fd400d64ffec: Pull complete Digest: sha256:e3358f55ea2b0cd432685d7e3c79a33a85c7a359b35fa87fc4993514b9573446 Status: Downloaded newer image for mysql:latest 24bfb1aa8b789a3254bd2f55cc759a6e0b0504a5a39ffe04d3d6848edaca6403
docker run -d -p3307:3307 -eMYSQL_ROOT_PASSWORD=123456 mysql:5.7 docker: Invalid ip address: 3306. See 'docker run --help'. dugang:~ dugang$ docker run -d -p3307:3307 -eMYSQL_ROOT_PASSWORD=123456 mysql:5.7 Unable to find image 'mysql:5.7' locally 5.7: Pulling from library/mysql 6552179c3509: Already exists d69aa66e4482: Already exists 3b19465b002b: Already exists 7b0d0cfe99a1: Already exists 9ccd5a5c8987: Already exists 2dab00d7d232: Already exists 5d726bac08ea: Already exists f2f4aec225fa: Pull complete 28a8d7e9eac1: Pull complete 96d7660d55cf: Pull complete c4976e34a8d2: Pull complete Digest: sha256:6c75a3ede385188dca74670e94c92ce11a0307a0ad4448265afe0d3c815dfe48 Status: Downloaded newer image for mysql:5.7 486d1d044452cab2b90128493e67cc34dc0033ede37ce8a5d3a51015b6685c6e

上一篇     下一篇
Temporal 架构简介

Temporal 本地环境搭建及测试

分布式任务调度一些技术点

temporal部署连接外部的postgres

使用 Dockerfile 构建 gohttphello server 镜像

temporal Java 例子说明