docker-compose.yml mysql

郭璞
2023-12-01

1. docker-compose.yml mysql

1.1. tree

|-- bak
|   `-- mysql
|       |-- conf.d
|       |   |-- docker.cnf
|       |   |-- mysql.cnf
|       |   `-- mysqldump.cnf
|       |-- my.cnf -> /etc/alternatives/my.cnf
|       |-- my.cnf.fallback
|       |-- mysql.cnf
|       `-- mysql.conf.d
|           `-- mysqld.cnf
|-- conf
|   |-- conf.d
|   |   |-- docker.cnf
|   |   |-- mysql.cnf
|   |   `-- mysqldump.cnf
|   |-- my.cnf
|   |-- my.cnf.fallback
|   |-- mysql.cnf
|   `-- mysql.conf.d
|       `-- mysqld.cnf
|-- docker-compose.yml
`-- restart5.sh

1.2. docker-compose.yml

version: '2'
services:
    mysql:
        container_name: "mysql5"
        network_mode: "bridge"
        environment:
            MYSQL_ROOT_PASSWORD: "1234@"
        image: "mysql:5"
        command: --default-authentication-plugin=mysql_native_password
        # restart: always
        volumes:
            - "/root/db5:/var/lib/mysql"
            - "/mnt/hgfs/share/docker-composes/mysql5/conf:/etc/mysql"
            - "/mnt/hgfs/share/docker-composes/mysql5/conf/my.cnf:/etc/my.cnf"
        ports:
            - "3306:3306"
            - "33060:33060"

1.3. restart5.sh

#/bin/sh

docker stop mysql5
docker rm mysql5
docker-compose up -d
docker ps -a

 类似资料: