docker搭建mysql+phpmyadmin
主要的坑:
- docker中的内网 ,容器互相访问
- 环境变量
- mysql 8 的目录大小写
compose 文件
# 用compose构建mysql + phpmyadmin服务器version: "3.1"
services:
mysql_server:
#mysq镜像
image: mysql
container_name: mysql_server
#启动参数
command: --default-authentication-plugin=mysql_native_password --lower-case-table-names=2
restart: always
#环境变量
environment:
MYSQL_ROOT_PASSWORD: "password"
#映射端口
ports:
- 3306:3306
#映射磁盘目录
volumes:
- "~/mysql-8.0.11/data:/var/lib/mysql"
- "~/mysql-8.0.11/my.cnf:/etc/my.cnf"
networks:
- net-mysql
phpmyadmin:
#mysq镜像
image: phpmyadmin/phpmyadmin
container_name: test-phpmyadmin
#环境变量
environment:
PMA_HOST: mysql_server
# PMA_PORT: "3306"
PMA_USER: "test"
PMA_PASSWORD: "test"
#映射端口
ports:
- 8082:80
networks:
- net-mysql
networks:
net-mysql:
docker-compose -f stack.yml up
参考链接:https://blog.csdn.net/Gekkoou/article/details/80897309
以上是 docker搭建mysql+phpmyadmin 的全部内容, 来源链接: utcz.com/z/512084.html