V
V
VicTHOR2021-11-26 14:25:45
MariaDB
VicTHOR, 2021-11-26 14:25:45

Why are there no rights to second base in the dump?

I dump 2 databases with the command

mysqldump --skip-lock-tables --databases project project-test | sed -e 's/DEFINER=[^*]*\*/\*/g' | gzip -c" > project.sql.gz

I specify the user with the full rights to these tables, not root.

I raise the database locally in docker compose
mariadb:
    image: mariadb:10.4.10
    ports:
      - "${MYSQL_PORT}:3306"
    networks:
      iternal:
    volumes:
      - mariadb:/var/lib/mysql
      - ./docker/mariadb/dump:/docker-entrypoint-initdb.d/
    environment:
      MYSQL_ROOT_PASSWORD: '${MYSQL_ROOT_PASSWORD}'
      MYSQL_DATABASE: '${MYSQL_DATABASE}'
      MYSQL_USER: '${MYSQL_USER}'
      MYSQL_PASSWORD: '${MYSQL_PASSWORD}'
      TZ: 'Europe/Moscow'

I connect to the database under the same user - and there he no longer has rights to the second project-test database ... How to make a dump so that the rights to this database for this user are tightened? Or is there something wrong with docker?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Karabanov, 2021-11-26
@VicTHOR

It's like that. Write a script that creates users and databases and adds GRANTs to them and place it in the directory /docker-entrypoint-initdb.d, you can also place dumps there, everything will be applied automatically.
See the README on the Docker HUB section "Initializing a fresh instance".

X
xmoonlight, 2015-04-12
@xmoonlight

php+dns

T
tef, 2015-04-12
@tef

It seems to me that you need to google about the principle of building databases.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question