Created
April 24, 2019 09:03
-
-
Save bfgits/83fa4aeba2f289af9b0fb4531158c353 to your computer and use it in GitHub Desktop.
mysql5.7配置文件模板
This file contains hidden or 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
# For advice on how to change settings please see | |
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html | |
# 以下模板是mysql5.7参照配置,差异配置属性请参照下行关键字 #diff: ,所有配置参数统一使用"-" | |
[mysql] | |
# CLIENT # | |
port = 3306 | |
socket=/var/lib/mysql/mysql.sock | |
default-character-set = utf8mb4 | |
#diff: Customize # | |
[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 | |
log-error=/var/log/mysqld.log | |
pid-file=/var/run/mysqld/mysqld.pid | |
user = mysql | |
default-storage-engine = InnoDB | |
#lower-case-table-names = 1 | |
##updata by ocean.wang | |
#skip-grant-tables | |
# MyISAM # | |
key-buffer-size = 512M | |
#diff: 4GB=256M# | |
#myisam-recover = FORCE,BACKUP | |
# SAFETY # | |
max-allowed-packet = 16M | |
max-connect-errors = 1000000 | |
skip-name-resolve | |
#innodb = FORCE | |
# BINARY LOGGING # | |
log-bin = /data/mysql-bin | |
expire-logs-days = 15 | |
sync-binlog = 1 | |
max-binlog-size = 1G | |
#server-id = 2117 | |
#diff: ip 192.168.2.117 = 2117 # | |
binlog-format = MIXED | |
#binlog-do-db = sfydbs | |
binlog-ignore-db = mysql | |
# CACHES AND LIMITS # | |
tmp-table-size = 512M | |
#diff: 4GB=256M# | |
max-heap-table-size = 512M | |
#diff: 4GB=256M# | |
query-cache-type = 0 | |
query-cache-size = 0 | |
max-connections = 1000 | |
thread-cache-size = 64 | |
#diff: 1G=8; 2G=16; 3G=32; >3G=64 # | |
open-files-limit = 65535 | |
table-definition-cache = 3000 | |
table-open-cache = 3000 | |
# INNODB # | |
innodb-flush-method = O_DIRECT | |
innodb-log-files-in-group = 2 | |
innodb-log-file-size = 512M | |
innodb-flush-log-at-trx-commit = 1 | |
innodb-file-per-table = 1 | |
innodb-buffer-pool-size = 6G | |
#diff: MEM*0.75 # | |
# LOGGING # | |
log-error = /slowlog/mysql-error.log | |
log-queries-not-using-indexes = 1 | |
#long-query-time = 3 | |
slow-query-log = 1 | |
slow-query-log-file = /slowlog/mysql-slow.log | |
#enable event_scheduler | |
event-scheduler = 1 | |
#diff: Customize # | |
default-password-lifetime=0 | |
# because mysql-5.7.4 ~ mysql-5.7.10 default-password-lifetime default is 360 ,if mysql @@version>5.7 please add ,else del # | |
character-set-server = utf8mb4 | |
collation-server = utf8mb4_general_ci | |
init-connect='SET NAMES utf8mb4' | |
skip-character-set-client-handshake = true | |
plugin-load=validate_password.so | |
validate_password_policy=0 | |
validate-password=FORCE_PLUS_PERMANENT | |
log_timestamps=SYSTEM | |
[client] | |
default-character-set=utf8mb4 | |
#diff: Customize # |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment