数据库
首页 > 数据库> > docker-compose 启动一个MySQL测试数据库

docker-compose 启动一个MySQL测试数据库

作者:互联网

services:
  mysql:
    image: mysql:5.7
    ports:
      - "3306:3306"
    expose:
      - "3306"
    environment:
      - MYSQL_USER=test
      - MYSQL_PASSWORD=123456
      - MYSQL_DATABASE=test
      - MYSQL_ROOT_PASSWORD=root
    volumes:
      - /home/z/env/mysql/mydir:/mydir
      - /home/z/env/mysql/datadir:/var/lib/mysql
      - /home/z/env/mysql/conf/my.cnf:/etc/my.cnf
      - /home/z/env/mysql/source:/docker-entrypoint-initdb.d

标签:compose,MySQL,cnf,MYSQL,env,mysql,3306,home,docker
来源: https://www.cnblogs.com/realzhaijiayu/p/16651658.html