Last active
December 3, 2021 11:37
-
-
Save lesstif/6355df92dd60b10d69eadc26e92db76a to your computer and use it in GitHub Desktop.
MySQL Server configuration file for docker.
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
#!/bin/bash | |
export MYSQL_CNF=$(cat <<CNF | |
# For advice on how to change settings please see | |
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html | |
[mysqld] | |
# | |
# Remove leading # and set to the amount of RAM for the most important data | |
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. | |
# innodb_buffer_pool_size = 128M | |
# | |
# Remove leading # to turn on a very important data integrity option: logging | |
# changes to the binary log between backups. | |
# log_bin | |
# | |
# Remove leading # to set options mainly useful for reporting servers. | |
# The server defaults are faster for transactions and fast SELECTs. | |
# Adjust sizes as needed, experiment to find the optimal values. | |
# join_buffer_size = 128M | |
# sort_buffer_size = 2M | |
# read_rnd_buffer_size = 2M | |
datadir=/var/lib/mysql | |
socket=/var/lib/mysql/mysql.sock | |
# Disabling symbolic-links is recommended to prevent assorted security risks | |
symbolic-links=0 | |
# strict SQL mode in MySQL 5.7 is default behaviour. | |
sql_mode=ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION | |
skip-character-set-client-handshake | |
collation-server=utf8mb4_unicode_ci | |
character-set-server=utf8mb4 | |
#collation-server=utf8_unicode_ci | |
#character-set-server=utf8 | |
max_allowed_packet = 256M | |
innodb_log_file_size=512M | |
transaction-isolation=READ-COMMITTED | |
[mysqld_safe] | |
log-error=/var/log/mysqld.log | |
pid-file=/var/run/mysqld/mysqld.pid | |
CNF | |
) | |
mkdir -p /etc/docker/mysql.conf.d | |
echo "${MYSQL_CNF}" > /etc/docker/mysql.conf.d/mysqld.cnf | |
## run docker with "-volume=/etc/docker/mysql.conf.d:/etc/mysql/mysql.conf.d" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment