使用Docker安装MySQL
version: '3'
services:
mysql:
environment:
MYSQL_ROOT_PASSWORD: ""
MYSQL_USER: ''
MYSQL_PASS: ''
image: "docker.io/mysql:latest"
restart: always
port:
- 3306:3306
volumes:
- "./db:/var/lib/mysql"
- "./conf/my.cnf:/etc/my.cnf"
- "./init:/docker-entrypoint-initdb.d/"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
init 目录创建init.sql
use mysql;
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'yourpassword';
1
2
2
编辑 (opens new window)
上次更新: 2023/04/09, 16:34:32