Mysql 8 Docker Compose
docker-compose.yml
YAML
services:
prod:
image: mysql:8.0
container_name: mysql8
hostname: mysql-8
command: '--default-authentication-plugin=mysql_native_password'
# cap_add:
# - SYS_NICE # CAP_SYS_NICE
volumes:
- ./conf:/etc/mysql/conf.d
- ./dbdata:/var/lib/mysql
ports:
- "3306"
environment:
# MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
MYSQL_ROOT_PASSWORD: urrootpass
MYSQL_USER: "user"
MYSQL_PASSWORD: "password"
MYSQL_DATABASE: "database"
healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
timeout: 20s
retries: 10
custom.cnf
Tweak mysql database.
- add in conf/custom.cnf
Text Only
[client]
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4
[mysqld]
default_authentication_plugin = mysql_native_password
max_connections = 666
bind-address = 0.0.0.0
collation-server = utf8mb4_unicode_ci
character-set-server = utf8mb4
If MySql is 8.4+ then use:
More options: