From 9b04f976203abd4bab15b6d07d9e85401af0778f 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 + etc/mysql/utf8.cnf | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 etc/mysql/utf8.cnf diff --git a/docker-compose.yml b/docker-compose.yml index e34bcbd20..fe8b32748 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 + - ./etc/mysql/utf8.cnf:/etc/mysql/conf.d/utf8.cnf:ro phpmyadmin: image: phpmyadmin/phpmyadmin diff --git a/etc/mysql/utf8.cnf b/etc/mysql/utf8.cnf new file mode 100644 index 000000000..4c4dccb5b --- /dev/null +++ b/etc/mysql/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