Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Docker / MySQL (utf8mb4)
version: "3"
services:
db:
image: mysql:5.7
container_name: sample-db
ports:
- 3344:3306
volumes:
- ./db/mysql:/var/lib/mysql
command:
[
"mysqld",
"--character-set-server=utf8mb4",
"--collation-server=utf8mb4_bin",
]
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: test
MYSQL_USER: test
MYSQL_PASSWORD: test
@itkrt2y

This comment has been minimized.

Copy link
Owner Author

@itkrt2y itkrt2y commented Dec 4, 2019

docker exec -it sample-db bash
mysql -u test -p

# Show character sets
SHOW VARIABLES LIKE '%char%';

# Show collations
SELECT
  DEFAULT_CHARACTER_SET_NAME,
  DEFAULT_COLLATION_NAME 
FROM
  INFORMATION_SCHEMA.SCHEMATA;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.