Last active
February 12, 2024 15:49
-
-
Save w0rldart/aa472db45c3817d937a1870a32f77820 to your computer and use it in GitHub Desktop.
MariaDB docker-compose with UTF8 Collation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.1' | |
services: | |
db: | |
image: mariadb | |
restart: always | |
command: mysqld --character-set-server=utf8 --collation-server=utf8_unicode_ci --init-connect='SET NAMES UTF8;' --innodb-flush-log-at-trx-commit=0 | |
ports: | |
- 3306:3306 | |
environment: | |
- MYSQL_ROOT_PASSWORD=example | |
- MYSQL_DATABASE=test | |
- MYSQL_USER=testuser | |
- MYSQL_PASSWORD=testpassword |
This didn't work for me sadly, first method just causes the container to fail with Can't create test file /opt/bitnami/mariadb/data/97647bac093c.lower-test
. Second method has no effect.
I have a UTF-8 SQL dump that includes emojis.
Try using the image mariadb as described in gist. Bitnami could have some customization, which might be incompatible with example above
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This doesn't work for me for any magic reason. My tables collations and collation of connection is still latin1_swedish_ci, although collation_server is utf8_unicode_ci. I solved it by setting this options to mysql config file directly (my.cnf).
my.cnf:
docker-compose.yml:
p.s. my.cnf is placed near docker-compose.yml in this example. You can put it in another folder, but you should change path in volumes part