- mysql5.7 docker-compose.yml
version: '3.1'
services:
db:
image: mysql:5.7.29
container_name: mysql5.7
restart: always
environment:
TZ: Asia/Shanghai
MYSQL_ROOT_PASSWORD: zx678603
command:
#mysql5.7及以上 版本 默认连接方式 不是以密码形式连接 所以远程连接不方便 改为密码连接
--default-authentication-plugin=mysql_native_password
--character-set-server=utf8mb4
--collation-server=utf8mb4_general_ci
--explicit_defaults_for_timestamp=true
--lower_case_table_names=1
--max_allowed_packet=128M
--sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO"
ports:
- 3306:3306
volumes:
- ./data:/var/lib/mysql
adminer:
image: adminer
restart: always
ports:
- 3307:8080