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 3 years have passed since last update.

DockerでMariaDBを使用した際に全角文字が入力できなかった件

Posted at

##概要
DockerでMariaDBを使用した際に、全角入力ができない事態に陥りました。
そこであれこれ試行錯誤したので、メモ用に保存しておきます。

・docker-compose.ymlファイルの内容
 コンテナ起動時に投入する初期データ関連のsqlファイルはinitdb.dディレクトリ下に。

services:
  db:
    build:
      context: .
      dockerfile: ./Dockerfile
    restart: always
    volumes:
      - ./initdb.d:/docker-entrypoint-initdb.d
    environment:
      MYSQL_ROOT_PASSWORD: $MYSQL_ROOT_PASSWORD
      MYSQL_USER: $MYSQL_USER
      MYSQL_PASSWORD: $MYSQL_PASSWORD
      TZ: "Asia/Tokyo"
    ports:
      - 3306:3306

・Dockerfileの内容
 (※ 現在(2021/10/7)の最新verは10.6であるが、10.6だと必要なレポジトリが存在しないため10.5を使用。)

FROM mariadb:10.5

RUN apt-get update && \
    apt-get install -y locales && \
    rm -rf /var/lib/apt/lists/* && \
    echo "ja_JP.UTF-8 UTF-8" > /etc/locale.gen && \
    locale-gen ja_JP.UTF-8
ENV LC_ALL ja_JP.UTF-8

RUN { \
    echo '[mysqld]'; \
    echo 'character-set-server=utf8mb4'; \
    echo 'collation-server=utf8mb4_general_ci'; \
    echo '[client]'; \
    echo 'default-character-set=utf8mb4'; \
} > /etc/mysql/conf.d/charset.cnf
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?