Skip to content

Latest commit

 

History

History
35 lines (23 loc) · 1.31 KB

docker-mysql.md

File metadata and controls

35 lines (23 loc) · 1.31 KB

Connect to MySQL inside of a Docker container

There may come a time when developing or managing a Monica instance that you would like to connect directly to the MySQL database being used.

For example you may want to

  • alter test data
  • generate custom metrics
  • ...

  1. Stop your Monica and MySQL containers if they are running
  2. Bind port 3306 in your container to 3306 on your host machine
    1. Add EXPOSE 3306:3306 to your Dockerfile under EXPOSE 80:80
    2. Add a ports node under mysql in docker-compose.yml with a 3306:3306 entry
  3. Start your containers with docker-compose up, wait for them to spin up
  4. Connect to the database via a MySQL client (CLI, GUI, etc.)

Sequel Pro (macOS)

You can install Sequel Pro from the website or via brew cask install sequel-pro if you have homebrew cask installed.

Connect to the database using the information in your .env file. In this example image we are using the default values.

SequelProConnecting

If that is successful you are now connected and can execute queries, look at schemas, etc.

SequelProConnected