MySQL 5.7 (Docker) environment construction memo

We will summarize the procedure for building a MySQL 5.7 environment using Docker and connecting with MySQL Workbench.

  project/
        ├ docker/
        |       └ data       #Mount location
        |       └ db/
        |          ├ my.cnf  #setting file
        └ docker-compose.yml  

** 1. Create docker-compose.yml. ** **

version: '3'

services:
  db:
    image: mysql:5.7
    container_name: mysql_container
    environment:
      MYSQL_ROOT_PASSWORD: rootpass
      MYSQL_DATABASE: sample_db
      MYSQL_USER: mysqluser
      MYSQL_PASSWORD: mysqlpass
    volumes:
    - ./docker/db/data:/var/lib/mysql
    - ./docker/db/my.cnf:/etc/mysql/conf.d/my.cnf
    restart: always
    ports:
    - 3306:3306

** 2. Create my.cnf (MySQL configuration file). ** **

[mysqld]
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci

[client]
default-character-set=utf8mb4

** 3. Start the MySQL container. ** **

Move to the above project folder and execute the following docker-compose command.

docker-compose up -d

** 4. Access the container from MySQL Workbench. ** **

  1. Select the tab Database->Manage Connections ....

The following Manage Server Connections screen is displayed. mysql_manage_server_connections.png

  1. Press New and enter the connection information described in docker-compose.yml.

  2. Check if you can connect to the container with Test Connection.

Recommended Posts

MySQL 5.7 (Docker) environment construction memo
Redmine (Docker) environment construction memo
Docker environment construction
Rails + MySQL environment construction with Docker
[Environment construction with Docker] Rails 6 & MySQL 8
[Docker] Development environment construction Rails6 / Ruby2.7 / MySQL8
Laravel + MySQL + phpMyadmin environment construction with Docker
Environment construction command memo with Docker on AWS
Rails6 [API mode] + MySQL5.7 environment construction with Docker
React + Django + Nginx + MySQL environment construction with Docker
[Docker] Rails 5.2 environment construction with docker
Docker × Spring Boot environment construction
[Rails / MySQL] Mac environment construction
[Docker] postgres, pgadmin4 environment construction
React environment construction with Docker
docker memo
virtulbox + vagrant + Docker + nginx + puma + MySQL Rails environment construction
Node.js environment construction with Docker Compose
◆ Spring Boot + gradle environment construction memo
Environment construction with Docker for beginners
Laravel + Docker Laradock usage environment construction
Ruby on Rails 6.0 environment construction memo
Rails on Docker environment construction procedure
Check MySQL logs in Docker environment
Easy environment construction of MySQL and Redis with Docker and Alfred
Rails application development environment construction with Docker [Docker, Rails, Puma, Nginx, MySQL]
docker tutorial (memo)
Docker operation memo
Build apache7.4 + mysql8 environment with Docker (with initial data) (your own memo)
GPU environment construction with Docker [October 2020 version]
Rails environment construction with Docker (personal apocalypse)
Spring Boot environment construction memo on mac
Laravel development environment construction with Docker (Mac)
Sapper × Go (echo) × Docker development environment construction
[Java] Environment construction
Create Rails 6 + MySQL environment with Docker compose
Java development environment construction memo on Mac
Environment construction with Docker (Ubuntu20.04) + Laravel + nginx
Edit Mysql with commands in Docker environment
Docker command memo
Create a MySQL environment with Docker from 0-> 1
Java environment construction
[Memo] docker summary
MySQL migration memo (1)
Spring Boot + Docker Java development environment construction
[Spring] Environment construction
"Rails 6 x MySQL 8" Docker environment construction procedure for sharing with teams
Rails & React & Webpacker & MySQL Environment Construction Manual
[Environment construction] Rails + MySQL + Docker (Beginners can also use it in 30 minutes!)
[Rails & Docker & MySQL environment construction] I started the container, but I can't find MySQL ...?
Spring Boot environment construction with Docker (January 2021 version)
Docker + DynamoDB local + C ++ environment construction and practice
[Memo] Create a CentOS 8 environment easily with Docker
Kaggle environment construction using official Docker and vscode
[Personal memo] Ruby on Rails environment construction (Windows)
A reminder of Docker and development environment construction
IntelliJ + Docker (APP + DB) + SpringBoot (Maven) environment construction
Wordpress local environment construction & development procedure with Docker
[Environment construction] Eclipse installation
[Flutter] Ubuntu 20.04 environment construction
[First environment construction] I tried to create a Rails 6 + MySQL 8.0 + Docker environment on Windows 10.