Easiest way to connect to the database

Hi,
as stated above i am looking for the easiest way to connect to the database, for example over phpmyadmin. All answers are welcome :slight_smile:

My docker-compose.yml file (Old Version, only the timezone was changed):

version: ā€˜3ā€™

services:
db:
image: mariadb:10
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
environment:
MYSQL_ROOT_PASSWORD: supersecret
MYSQL_DATABASE: vikunja
volumes:

  • ./db:/var/lib/mysql
    restart: unless-stopped
    api:
    image: vikunja/api
    environment:
    VIKUNJA_DATABASE_HOST: db
    VIKUNJA_DATABASE_PASSWORD: supersecret
    VIKUNJA_DATABASE_TYPE: mysql
    VIKUNJA_DATABASE_USER: root
    VIKUNJA_DATABASE_DATABASE: vikunja
    volumes:
  • ./files:/app/vikunja/files
    depends_on:
  • db
    restart: unless-stopped
    frontend:
    image: vikunja/frontend
    restart: unless-stopped
    proxy:
    image: nginx
    ports:
  • 80:80
    volumes:
  • ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
    depends_on:
  • api
  • frontend
    restart: unless-stopped

An easy way would probably be to just use the pma docker image.

Another way (if you donā€™t need a gui) would be to just use the mysql cli in the container with something like docker-compose exec db mysql -u root -p vikunja.

I set up all my containers that use MySQL or MariaDB with a second network that I label as ā€œexternalā€ (so docker-compose down doesnā€™t destroy it) that also has a PHPMySQL container attached to it. I donā€™t make it public or anything, but if Iā€™m on my home network, or VPNā€™d in, I can get to the PHPMyAdmin instance and log into any of the other containersā€™ databases.

ProTip: Make sure to add in the ā€œhostnameā€ property on all of the other database containers so that they donā€™t collide with each other on that second network.