Skip to content

Instantly share code, notes, and snippets.

@kawahiro311
Last active November 26, 2017 07:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kawahiro311/c6e2795a2a09558cb5db001aade3f0a4 to your computer and use it in GitHub Desktop.
Save kawahiro311/c6e2795a2a09558cb5db001aade3f0a4 to your computer and use it in GitHub Desktop.
dockerでmysql環境の構築

dockerでmysql環境の構築

$ docker-compose build
...

$ docker-compose up -d
Starting mysql57sandbox_db_1 ... 
Starting mysql57sandbox_db_1 ... done

$ docker-compose ps
       Name                     Command             State    Ports  
--------------------------------------------------------------------
mysql57sandbox_db_1   docker-entrypoint.sh mysqld   Up      3306/tcp

$ docker exec -it mysql57sandbox_db_1 bash
root@89aab627a979:/# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.20 MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show variables like "chara%";
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8mb4                    |
| character_set_connection | utf8mb4                    |
| character_set_database   | utf8mb4                    |
| character_set_filesystem | binary                     |
| character_set_results    | utf8mb4                    |
| character_set_server     | utf8mb4                    |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
[mysqld]
character-set-server=utf8mb4
collation-server=utf8mb4_general_ci
[client]
default-character-set=utf8mb4
version: '3'
services:
db:
build: .
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
FROM mysql:5.7
COPY ./charset.cnf /etc/mysql/conf.d/charset.cnf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment