MySQL snippets

Page content

Create a temporary Docker MySQL container

docker run \
--detach \
--name=mysqltest \
--env="MYSQL_ROOT_PASSWORD=FoOPass123" \
--publish 3306:3306 \
mysql

PhpMyAdmin (Docker)

Before run this command, check the network of MySQL container with docker inspect mytestest.

docker run --name myadmin -d -e PMA_HOST=172.17.0.2 -e PMA_PORTS=3306 -p 8080:80 phpmyadmin

Open the browser and go http://localhost:8080. The user is MySQL user (root and FoOPass123 in my case).

MySQL workbench (Docker, I don’t use this way)

I found this image.

https://hub.docker.com/r/linuxserver/mysql-workbench

Caution:

  • This method run MySQL workbench on Docker container. Check the network of the container.
  • You will access to MySQL workbench via browser. Apache Guacamole runs on the container.
---
version: "2.1"
services:
  mysql-workbench:
    image: lscr.io/linuxserver/mysql-workbench
    container_name: mysql-workbench
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/London
    ports:
      - 3000:3000
    cap_add:
      - IPC_LOCK
    restart: unless-stopped

docker compose up