Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

195
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!