Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
  1. 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.

  2. Create a Docker project directory for your mysql container. Name it something like ~/docker/mysqldb

  3. In that directory, create a file called docker-compose.yml. Its contents should contain

    Code Block
    languageyaml

...

  1. 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.

...