cyberneticlibrary

Run MySQL queries on Docker database

dbcommandsetup L115
openva/richmondsunlight.com
What it does

Execute MySQL queries against Docker database

Best for

Quick ad-hoc database queries during development when Docker Compose is the deployment model and CLI access is faster than GUI tools.

Inputs
  • · SQL query string
Outputs
  • · SQL result rows
Requires
  • · Docker Compose
  • · MySQL CLI
Preconditions
  • · docker-compose.yml defines 'db' service
  • · database user/password configured
  • · database name specified (richmondsunlight)
Failure modes
  • · db container not running (docker exec fails)
  • · MySQL credentials incorrect
  • · query syntax error
  • · database does not exist
Trust signals
  • · credential-free syntax (reads from compose file)
  • · no-tty flag (-T) prevents docker exec hanging