docker-compose部署mysql外挂数据盘并指定字符集
docker-compose.ymlversion: '3.3'services:db:image: mysql:5.7privileged: truerestart: alwayscommand: [--character-set-server=utf8mb4--collation-server=utf8mb4_u...
·
docker-compose.yml
version: '3.3'
services:
db:
image: mysql:5.7
privileged: true
restart: always
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --explicit_defaults_for_timestamp=true --lower_case_table_names=1 --max_allowed_packet=128M --sql-mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
environment:
MYSQL_DATABASE: 'db'
MYSQL_USER: 'root'
MYSQL_PASSWORD: 'mysql123456'
MYSQL_ROOT_PASSWORD: 'mysql123456'
ports:
- '3306:3306'
expose:
- '3306'
volumes:
- /data/docker/mysql:/var/lib/mysql
privileged: true
因为没有root权限此命令可设置容器为特例容器 :
外挂盘:
volumes:
- /data/docker/mysql:/var/lib/mysql
指定字符集:
command: [
'--character-set-server=utf8mb4',
'--collation-server=utf8mb4_unicode_ci',:
]
更多推荐
已为社区贡献2条内容
所有评论(0)