使用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

选择镜像版本 (opens new window)

init 目录创建init.sql

use mysql;
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'yourpassword';
1
2
上次更新: 2023/04/09, 16:34:32
最近更新
01
go-admin-ui项目仿写练手1-登录页
06-29
02
maven依赖问题
06-17
03
JVM相关命令
02-21
更多文章>