mysqldockercontainerspodmanadminer

Why can I connect to my MySQL db just fine through MySQL Workbench, but not with Adminer?


I've created a Podman Pod using podman kube play dbstack.yml which pulls three images from the Docker Hub: MySQL, MySQL Workbench, Adminer, and creates a Pod with these three containers. When I go to localhost:3000 (Workbench) in my web browser and enter the credentials I've set into the web interface, I can successfully connect to the MySQL database; however, when I go to localhost:8080 (Adminer) and provide the exact same credentials, I get hit with a No such file or directory error. It has to be something with the way Adminer is set up because if I tear down the pod, and rebuild it with phpMyAdmin, entering the same credentials I enter into Workbench works just fine.

This is the YAML:

---
# database stack
apiVersion: v1
kind: Pod
metadata:
  name: "dbstack"
spec:
  restartPolicy: unless-stopped
  securityContext:
    fsGroup: 1000

  containers:
    - name: "mysql"
      image: "docker.io/mysql:latest"
      securityContext:
        runAsUser: 1001
        runAsGroup: 1001
      ports:
        - containerPort: 3306
      volumeMounts:
        - name: "mysql-data"
          mountPath: "/var/lib/mysql:z"
      env:
        - name: "MYSQL_ROOT_PASSWORD"
          valueFrom:
            secretKeyRef:
              name: "dbstack-secrets"
              key: "MYSQL_ROOT_PASSWORD"
        - name: "MYSQL_USER"
          valueFrom:
            secretKeyRef:
              name: "dbstack-secrets"
              key: "MYSQL_USER"
        - name: "MYSQL_PASSWORD"
          valueFrom:
            secretKeyRef:
              name: "dbstack-secrets"
              key: "MYSQL_PASSWORD"
        - name: "TZ"
          value: "Etc/UTC"
      hostname: "mysql-host"

    - name: "mysql-workbench"
      image: "lscr.io/linuxserver/mysql-workbench:latest"
      securityContext:
        capabilities:
          add: ["IPC_LOCK"]
      env:
        - name: "PUID"
          value: "1000"
        - name: "PGID"
          value: "1000"
        - name: "TZ"
          value: "Etc/UTC"
      ports:
        - containerPort: 3000
          hostPort: 3000
      volumeMounts:
        - name: "mysql-workbench-data"
          mountPath: "/config:z"

    - name: "adminer"
      image: "docker.io/adminer:latest"
      env:
        - name: "MYSQL_ROOT_PASSWORD"
          valueFrom:
            secretKeyRef:
              name: "dbstack-secrets"
              key: "MYSQL_ROOT_PASSWORD"
        - name: "MYSQL_USER"
          valueFrom:
            secretKeyRef:
              name: "dbstack-secrets"
              key: "MYSQL_USER"
        - name: "MYSQL_PASSWORD"
          valueFrom:
            secretKeyRef:
              name: "dbstack-secrets"
              key: "MYSQL_PASSWORD"
      ports:
        - containerPort: 8080
          hostPort: 8080

  volumes:
    - name: "mysql-data"
      persistentVolumeClaim:
        claimName: "mysql-data-claim"
    - name: "mysql-workbench-data"
      persistentVolumeClaim:
        claimName: "mysql-workbench-data-claim"

---
# Persistent Volume Claim for mysql-data volume
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: "mysql-data-claim"
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: "5Gi"

---
# Persistent Volume Claim for mysql-workbench-data volume
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: "mysql-workbench-data-claim"
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: "1Gi"

---
# Secrets for MySQL passwords
apiVersion: v1
kind: Secret
metadata:
  name: "dbstack-secrets"
  creationTimestamp: null
type: Opaque
stringData:
  MYSQL_ROOT_PASSWORD: "StrongPass123"
  MYSQL_USER: "dbuser"
  MYSQL_PASSWORD: "dbuserpass"


Snippet from the logs:

...
dbstack-adminer          | [Tue Apr 25 21:58:20 2023] [::ffff:10.89.0.13]:41300 Accepted
dbstack-adminer          | [Tue Apr 25 21:58:20 2023] [::ffff:10.89.0.13]:41300 [200]: GET /
dbstack-adminer          | [Tue Apr 25 21:58:20 2023] [::ffff:10.89.0.13]:41300 Closing
dbstack-adminer          | [Tue Apr 25 21:58:34 2023] [::ffff:10.89.0.13]:42660 Accepted
dbstack-adminer          | [Tue Apr 25 21:58:34 2023] [::ffff:10.89.0.13]:42660 [302]: POST /
dbstack-adminer          | [Tue Apr 25 21:58:34 2023] [::ffff:10.89.0.13]:42660 Closing
dbstack-adminer          | [Tue Apr 25 21:58:34 2023] [::ffff:10.89.0.13]:42668 Accepted
dbstack-adminer          | [Tue Apr 25 21:58:34 2023] [::ffff:10.89.0.13]:42668 [403]: GET /?server=localhost%3A3306&username=root
dbstack-adminer          | [Tue Apr 25 21:58:34 2023] [::ffff:10.89.0.13]:42668 Closing
dbstack-adminer          | [Tue Apr 25 21:59:01 2023] [::ffff:10.89.0.13]:41376 Accepted
dbstack-adminer          | [Tue Apr 25 21:59:01 2023] [::ffff:10.89.0.13]:41376 [302]: POST /?server=localhost%3A3306&username=root
dbstack-adminer          | [Tue Apr 25 21:59:01 2023] [::ffff:10.89.0.13]:41376 Closing
dbstack-adminer          | [Tue Apr 25 21:59:01 2023] [::ffff:10.89.0.13]:41390 Accepted
dbstack-adminer          | [Tue Apr 25 21:59:01 2023] [::ffff:10.89.0.13]:41390 [403]: GET /?server=localhost%3A3306&username=dbuser
dbstack-adminer          | [Tue Apr 25 21:59:01 2023] [::ffff:10.89.0.13]:41390 Closing
...

I've tried different approaches:

What am I doing wrong?


Solution

  • Looks like the solution was setting ADMINER_DEFAULT_SERVER's value to simply mysql.