Skip to content
This repository was archived by the owner on Nov 29, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add charset configuration after MySQL is installed
  • Loading branch information
edwardsamuel committed Oct 3, 2015
commit d2e885c200ff75cb8e0f3c27ca21dcae61864c06
4 changes: 3 additions & 1 deletion 5.5/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ MAINTAINER Fernando Mayo <[email protected]>, Feng Honglin <[email protected]>

# Add MySQL configuration
ADD my.cnf /etc/mysql/conf.d/my.cnf
ADD mysqld_charset.cnf /etc/mysql/conf.d/mysqld_charset.cnf

RUN apt-get update && \
apt-get -yq install mysql-server-5.5 pwgen && \
Expand All @@ -13,6 +12,9 @@ RUN apt-get update && \
mysql_install_db > /dev/null 2>&1 && \
touch /var/lib/mysql/.EMPTY_DB

# Add MySQL charset configuration
ADD mysqld_charset.cnf /etc/mysql/conf.d/mysqld_charset.cnf

# Add MySQL scripts
ADD import_sql.sh /import_sql.sh
ADD run.sh /run.sh
Expand Down
4 changes: 3 additions & 1 deletion 5.6/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ MAINTAINER Fernando Mayo <[email protected]>, Feng Honglin <[email protected]>

# Add MySQL configuration
ADD my.cnf /etc/mysql/conf.d/my.cnf
ADD mysqld_charset.cnf /etc/mysql/conf.d/mysqld_charset.cnf

RUN apt-get update && \
apt-get -yq install mysql-server-5.6 pwgen && \
Expand All @@ -13,6 +12,9 @@ RUN apt-get update && \
mysql_install_db > /dev/null 2>&1 && \
touch /var/lib/mysql/.EMPTY_DB

# Add MySQL charset configuration
ADD mysqld_charset.cnf /etc/mysql/conf.d/mysqld_charset.cnf

# Add MySQL scripts
ADD import_sql.sh /import_sql.sh
ADD run.sh /run.sh
Expand Down
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,31 @@ Examples:

Now you can access port `3306` and `3307` for the master/slave MySQL.


Character set and collation
---------------------------
To change MySQL character set and collation, please set environment variable `MYSQL_CHARACTER_SET` and `MYSQL_COLLATION` to any supported value by MySQL server. By default, `utf8mb4` and `utf8mb4_unicode_ci` are used in order to support 4-bytes unicode character (including emoji, astral symbol, etc.).

To ensure to use `utf8mb4` and `utf8mb4_general_ci`:

docker run -d -e MYSQL_CHARACTER_SET=utf8mb4 -e MYSQL_COLLATION=utf8mb4_general_ci -p 3306:3306 --name mysql tutum/mysql

To use `utf8` and `utf8_general_ci`:

docker run -d -e MYSQL_CHARACTER_SET=utf8 -e MYSQL_COLLATION=utf8_general_ci -p 3306:3306 --name mysql tutum/mysql


Environment variables
---------------------

`MYSQL_USER`: Set a specific username for the admin account (default 'admin').
`MYSQL_USER`: Set a specific username for the admin account (default `admin`).

`MYSQL_PASS`: Set a specific password for the admin account.

`MYSQL_CHARACTER_SET`: Set a specific character encoding set (default `utf8mb4`)

`MYSQL_COLLATION`: Set a specific collation (default `utf8mb4_unicode_ci`)

`STARTUP_SQL`: Defines one or more SQL scripts separated by spaces to initialize the database. Note that the scripts must be inside the container, so you may need to mount them.

Compatibility Issues
Expand Down