Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

197
Visualizações
Query MySql database in Docker

I have a docker container with mariadb, and have created a database my_db in it (through an external script in a different container). How can I run SQL queries on my_db now from the command line? I just want to do

select * from my_table

from the terminal that is running the container.

about 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Easiest way is to exec into the container and execute the query using the mysql client, given the clients installed.

docker exec -it CONTAINER_NAME mysql -p -e 'QUERY' DB_NAME
about 4 years ago · Santiago Trujillo Relatório

0

If you have the commandline tool installed in the app container,

mysql -h 192.168.1.7 -u admin -pxyz -P 10202

This allows for the docker instance to be on another machine (192...) and with a special port (-P ...), etc. (I have multiple docker containers; that one is for MariaDB 10.2.2.)

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda