Files
monica/docs/database/connecting.md
T
Taryn Hill 9db75894d3 Add a file documenting how to connect to the MySQL database in a Docker container (#300)
* Add a file documenting how to connect to the MySQL database in a Docker container
* Link to docs/database/connecting.md from the main readme and the docker setup instructions
2017-06-15 15:08:26 -04:00

1.2 KiB

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