Install and start Docker. If you’re on Mac, you can download and install Docker Desktop (https://www.docker.com/products/docker-desktop). Note that you’ll need to create a Docker account.
Create a Docker project directory for your mysql container. Name it something like ~/docker/mysqldb
In that directory, create a file called docker-compose.yml. Its contents should contain
Code Block language yaml
...
services: db: image: mysql environment: MYSQL_ROOT_PASSWORD: 'fill-this-in' ports: - '3306:3306'
The root password provided is the password to the root mysql account. Under ports, you map port 3306 in the Docker container to port 3306 on your local machine.
4. In the same directory, run docker - compose up -d
. This will launch a Docker contained container running your MySQL server.
...