I have Windows OS. When I try to migrate in Docker I get an error
(details: Error 1366: Incorrect string value: 'xD0x9CxD0xBExD0xB4...' for column 'name' at row 1)
app | make: *** [Makefile:30: migrate.up] Error 1
And in the Docker logs it also says
mysqld: [Warning] World-writable config file '/etc/mysql/my.cnf' is ignored.
My docker-compose file:
mysql:
image: mysql:alpine
platform: linux/amd64
restart: "on-failure"
ports:
- "3307:3306"
env_file: .env
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
timeout: 5s
volumes:
- ./db/my.cnf:/etc/mysql/my.cnf:ro
My config:
[client]
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4
[mysqld]
character-set-client-handshake = FALSE
init_connect ='SET collation_connection = utf8mb4_general_ci'
init_connect ='SET NAMES utf8mb4'
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
explicit_defaults_for_timestamp = 1
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
The problem with migration only goes away if you directly set the encoding type in docker-compose.
command: ['mysqld', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci']
But at the same time, broken characters are displayed in the CMD or PowerShell due to the Cyrillic alphabet.
All UTF-8 and Line-Sepator files are configured as LF.