1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| version: '3.6' services: mysql-server: image: mysql:5.7 container_name: mysql-server restart: always volumes: - "./data:/var/lib/mysql:rw" # linux使用 - "/usr/share/zoneinfo/Asia/Shanghai:/etc/localtime:ro" # macos使用 # - "/var/db/timezone/zoneinfo/Asia/Shanghai:/etc/localtime:ro" environment: - "MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}" - "TZ=Asia/Shanghai" - "LANG=C.UTF-8" ports: - 3306:3306 command: --wait-timeout=28800 --init-connect='SET NAMES utf8mb4' --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --character-set-client-handshake=FALSE --explicit_defaults_for_timestamp=true --max_allowed_packet=500M --lower_case_table_names=1 --log-bin=mysql-bin --server-id=1 --expire_logs_days=7 --log_timestamps=SYSTEM --default-time-zone='+08:00' --sql-mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" --innodb-flush-log-at-trx-commit=1 networks: local-networks: ipv4_address: 172.20.0.2
networks: local-networks: external: true
|