How to Set up a Local mysql Docker and View it using TablePlus

jzfrank

jzfrank

Posted on June 21, 2023

How to Set up a Local mysql Docker and View it using TablePlus

Create an empty folder. Open the folder.

Create two files: docker-compose.yml and docker.env.

In docker-compose.yml file:

version: "3.7"
services:
  db:
    image: mysql:8.0.33
    env_file: docker.env
    ports:
      - "3306:3306"
Enter fullscreen mode Exit fullscreen mode

Then in docker.env file:

MYSQL_ROOT_PASSWORD=pass
MYSQL_DATABASE=mydb
DB_NAME=mydb
DB_HOST=db
Enter fullscreen mode Exit fullscreen mode

Make sure docker is opened. Run

docker compose up --build 
Enter fullscreen mode Exit fullscreen mode

Now your mysql instance is running with connection string mysql://root:pass@127.0.0.1:3306/mydb.

To view the database, open TablePlus, create a new connection with above connection string.

💖 💪 🙅 🚩
jzfrank
jzfrank

Posted on June 21, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related