创建目录
mkdir -p /usr/local/docker/mysql
vi docker-compose.yml
version: '3.1'
services:
db:
image: mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: 123456
command:
--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
ports:
- 3306:3306
volumes:
- ./data:/var/lib/mysql
# MySQL 的 Web 客户端,可尝鲜,不能上生产,不尝鲜请删除以下配置
adminer:
image: adminer
restart: always
ports:
- 8080:8080
docker-compose up -d
端口 : 3306
账户:root
密码:123456
网友评论