使用 docker-compose 命令启动程序,首先创建 docker-compose.yml文件, 使用映射设置数据和配置信息,避免container删除后对应的数据和配置消失
# docker-compose.yml
version: "3.1"
services:
mysql8:
image: mysql:latest
command: --default-authentication-plugin=mysql_native_password
restart: always
ports:
- "3306:3306"
- "33060:33060"
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: windigniter
MYSQL_USER: windigniter
MYSQL_PASSWORD: windigniter
volumes:
- /data/database/mysql_data:/var/lib/mysql
- /data/dockers/mysql8/conf:/etc/mysql
- /data/logs:/logs
- /usr/dockers/mysql8/mysql-files:/var/lib/mysql-files
# - /etc/localtime:/etc/localtime:ro
adminer:
image: adminer
restart: always
ports:
- 8080:8080
验证方式修改为 mysql_native_password, 目前,一些情况下使用caching_sha2_password 存在问题,如验证不了登录不上。
(162)