Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

  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

    version: '3.3'
    
    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 running your MySQL server.

Now you can connect to the instance as normal using mysql command line or MySQLWorkbench. (Note that mysql clients before 8.0 can't connect to mysql 8.0+)

  • No labels