DEV Community

Yiran Jing for Bytebase

Posted on β€’ Originally published at bytebase.com

2 2 2 2 2

Run a Local πŸ’» MySQL 🐬 Instance

This document describes how to run a MySQL instance locally with Docker and how to add it as an Instance for testing purpose.

Step 1 - Start a local MySQL server in Docker

  1. Start Docker.
  2. Run the command in the terminal

    docker run --name mysqld \
      --publish 3306:3306 \
      -e MYSQL_ROOT_HOST=172.17.0.1 \
      -e MYSQL_ROOT_PASSWORD=testpwd1 \
      mysql/mysql-server:8.0
    

The setup below is for testing purpose and should NOT be used in production setup. Also the MySQL data will be wiped out after the container stops.

Step 2 - Add the MySQL Server as an Instance

  1. Click Instances on the top bar.
  2. Click Add Instance on the instances page, and you will see Create Instance dialog box.
  3. Fill the fields as follows:
    • Choose MySQL
    • Instance Name: MySQL Docker for Test
    • Environment: Test
    • Host or Socket: host.docker.internal
    • Port: 3306
    • Username: root
    • Password: testpwd1
  4. Click Create, and you can see the newly added instance in the table.

Imagine monitoring actually built for developers

Billboard image

Join Vercel, CrowdStrike, and thousands of other teams that trust Checkly to streamline monitor creation and configuration with Monitoring as Code.

Start Monitoring

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

πŸ‘‹ Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Communityβ€”every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple β€œthank you” goes a long wayβ€”express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay