From 033347d09b916aa784ff87fa6494d41432aecb4a Mon Sep 17 00:00:00 2001 From: Dominique Quatravaux Date: Thu, 15 Feb 2018 11:05:03 +0100 Subject: [PATCH] Set default character set on server to utf8mb4 Fixes #235 * Not just utf8, as per https://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html --- docker-compose.yml | 1 + mysql-conf.d/utf8.cnf | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 mysql-conf.d/utf8.cnf diff --git a/docker-compose.yml b/docker-compose.yml index e34bcbd20..310eda3fb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,6 +8,7 @@ services: - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} volumes: - ./volumes/db:/var/lib/mysql + - ./mysql-conf.d:/etc/mysql/conf.d:ro phpmyadmin: image: phpmyadmin/phpmyadmin diff --git a/mysql-conf.d/utf8.cnf b/mysql-conf.d/utf8.cnf new file mode 100644 index 000000000..4c4dccb5b --- /dev/null +++ b/mysql-conf.d/utf8.cnf @@ -0,0 +1,10 @@ +[mysqld] + +# https://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html +# says: "The character set named utf8 uses a maximum of three bytes +# per character and contains only BMP characters." +# If you want emoji (which your users most probably do), you need to +# use utf8mb4 instead. + +character-set-server=utf8mb4 +collation-server=utf8mb4_unicode_ci