How to Set up a Local mysql Docker and View it using TablePlus
jzfrank
Posted on June 21, 2023
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"
Then in docker.env
file:
MYSQL_ROOT_PASSWORD=pass
MYSQL_DATABASE=mydb
DB_NAME=mydb
DB_HOST=db
Make sure docker is opened. Run
docker compose up --build
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
Posted on June 21, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.