Skip to content

Run phpMyAdmin in container to examine MariaDB

Kayvan Sylvan edited this page Aug 28, 2017 · 2 revisions

Examining the Postfix DB

An easy way to look at the MariaDB database used by postfix is to run myphpadmin.

The easiest way to run that is as a docker container.

I only run it on a per-needed basis, using ssh port-forwarding, for a more secure setup.

ssh -L 8080:localhost:8080 [email protected]

On my mailserver machine, in ~deploy/phpmyadmin, I have the following shell script:

#!/bin/sh
case "$1" in
  start) 
    docker rm -f myadmin >/dev/null 2>&1
    docker run --name myadmin --network deploy_default -d --link mariadb:db -p 8080:80 phpmyadmin/phpmyadmin
    ;;
  stop)
    docker rm -f myadmin >/dev/null 2>&1
    ;;
  *)
    echo "Usage: $0 [start | stop]"
    ;;
esac

With that in place (and made executable via chmod +x ./phpmyadmin, I run the script when I want to examine the DB:

./phpmyadmin start
61ce48e4760886035b426d8795011c5f6651202bc056852431c40d6c7470db01

Now, on my local machine, I can visit localhost:8080

User name is root with the password being what you have as MYSQL_ROOT_PASSWORD in your docker-compose.yml (or, you can use postfix as the user and your MYSQL_PASSWORD for the password).

When you are done, do:

./phpmyadmin stop
Clone this wiki locally