0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

dockerでmysql環境構築

Posted at

dockerでmysqlの設定をする。

便利なまとめがあるので、読みながら設定。

docker-compose.yml
version: '3'

services:
  db:
    image: mysql:8.0.37
    container_name: mysql_prologue
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: ${ROOT_PASS}
      MYSQL_DATABASE: ${DB_NAME}
      MYSQL_USER: ${DB_USER}
      MYSQL_PASSWORD: ${DB_PASS}
      TZ: ${TZ}
    ports:
        - ${DB_PORT}:3306
    volumes:
        - db-store:/var/lib/mysql
        - ./conf/my.cnf:/etc/mysql/conf.d/my.cnf
volumes:
  db-store:
my.cnf
[mysqld]
character-set-server=utf8mb4
collation-server=utf8mb4_bin

[client]
default-character-set=utf8mb4
.env
ROOT_PASS=ルートのパスワード
DB_NAME=prologue
DB_USER=user
DB_PASS=実際使うユーザのパスワード
DB_PORT=3306
TZ=Asia/Tokyo
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?