L
L
LionG2020-01-21 15:27:30
MariaDB
LionG, 2020-01-21 15:27:30

Why can't I reach the MariaDB console in a Docker container?

Launched the MariaDB container. The connection to the database is established and it is fully working (connected from phpMyAdmin, HeidiSQL, JS scripts).
The next step was setting up the database backup. And then a problem arose.
I go into the container, connect to the MYSQL console, ask for the admin password and after entering it - silence.
Without entering the container, I connect to the MYSQL console using standard linux tools, referring to the container database, it also asks for the admin password and after entering it - silence.
Tried to connect from outside - the same result.

docker-compose exec mysql sh 'mysql -uroot -pSECRET' > all-databases.sql

creates an empty file although there is a database, I suspect that an empty response also comes to the execution of this command, so it is written
(a command from the documentation for backup from a container)
There is nothing suspicious in the MYSQL logs.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Georg Gaal, 2020-02-02
@gecube

Because the mysql utility needs a terminal. docker exec ...Simply use insteaddocker exec -it ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question