V
V
Vanookay2020-05-16 17:44:44
MySQL
Vanookay, 2020-05-16 17:44:44

Why is mysql not picking up the contents of docker-entrypoint-initdb.d?

Hello, for some reason it does not automatically pick up files from docker-entrypoint-initdb.d
docker-compose.yml:

version: "3.1"
services:
    www:
        build: .
        ports: 
            - "8001:80"
        volumes:
            - ./www:/var/www/html/
        links:
            - db
        networks:
            - default
    db:
        image: mysql:8.0
        ports:
            - "3306:3306"
        command: --default-authentication-plugin=mysql_native_password
        environment:
            MYSQL_DATABASE: sphere
            MYSQL_USER: root
            MYSQL_PASSWORD: test
            MYSQL_ROOT_PASSWORD: test
        volumes:
            - ./dump:/docker-entrypoint-initdb.d
            - ./conf:/etc/mysql/conf.d
            - ./persistent:/var/lib/mysql
        networks:
            - default
    phpmyadmin:
        image: phpmyadmin/phpmyadmin
        links:
            - db:db
        ports:
            - 8000:80
        environment:
            MYSQL_USER: root
            MYSQL_PASSWORD: test
            MYSQL_ROOT_PASSWORD: test
volumes:
    persistent:

in the dump folder is the script init.db:
CREATE DATABASE test
All day killed to find the reason why it does not capture sql files, can someone come across?
It may even help to directly execute this sql file, but how to do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2020-05-16
@q2digger

Try the following.
1. rename the init.db file to init.sql
2. in the line

CREATE DATABASE test
add a closing semicolon.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question