M
M
Max Mabius2018-05-06 19:55:46
MariaDB
Max Mabius, 2018-05-06 19:55:46

How to create 2 users in docker-compose?

What does the creation of two users at the same time look like, there is nothing in the specs, I have already climbed and tried everything:
one is clear

mariadb:
    image: mariadb:10.1.30
    ports:
      - 3306:3306
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=root
      - MYSQL_DATABASE=newdb
      - MYSQL_USER=user1
      - MYSQL_PASSWORD=pass

and how to create two users?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kirill Romanov, 2018-05-06
@Djaler

The standard API of this image is not suitable for this. You will have to create a user manually using commands

I
intelligence, 2018-05-07
@intelligence

You can create your own image, mariadb and many other databases have their own mechanism for dropping scripts - the /docker-entrypoint-initdb.d/ folder https://github.com/docker-library/mariadb/blob/a8f...
You can try something like this:

FROM mariadb:10.3 #или любая другая версия
COPY create-user.sql /docker-entrypoint-initdb.d/

And in the necessary sql already do anything. sql can also be replaced with sh script.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question