欢迎来到IDC91站长网!
解决服务器各种技术问题,加微信uecomzsr

MySQL

当前位置: IDC91 > 数据库 > MySQL

mysql 5.7 的 /etc/my.cnf 参数介绍

时间:2022-05-30 13:58:43|栏目:MySQL|点击:

下面是 mysql 5.7 的 /etc/my.cnf 的一些常用参数,自己记录一下,随时补充完善。

Default options are read from the following files in the given order:

/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf

[client]
port = 3306
default-character-set=utf8mb4
socket=/tmp/mysql.sock

[mysql]
#prompt="u@h :d r:m:s> "
prompt="u@h R:m:s [d]> "
#no-auto-rehash
auto-rehash
default-character-set=utf8mb4
socket=/tmp/mysql.sock

[mysqld]
##########################
# summary
##########################
skip_name_resolve = on
#skip-grant-tables
#skip-networking

bind-address = 0.0.0.0
port = 3306
basedir=/usr/local/mysql
datadir=/data/mysql
socket=/tmp/mysql.sock
tmpdir = /tmp
pid-file=/tmp/mysqld.pid

explicit_defaults_for_timestamp=1
lower_case_table_names=1

table_open_cache = 8000
transaction_isolation = 'REPEATABLE-READ'

##########################
# time out
##########################
connect_timeout = 20
wait_timeout = 300
interactive_timeout = 300

##########################
# connection
##########################
max_connections = 2000
max_user_connections = 1900
max_connect_errors = 100000
max_allowed_packet = 1G

##########################
# character set
##########################
character-set-server = utf8mb4
collation-server = utf8mb4_bin

##########################
# log bin
##########################
server-id = 1
log_bin = mysql-bin
# ROW、STATEMENT、MIXED
binlog_format = row
sync_binlog = 1
expire_logs_days = 7
binlog_cache_size = 128m
max_binlog_cache_size = 512m
max_binlog_size = 256M
master_info_repository=TABLE
log_slave_updates=ON
binlog_checksum=none

#binlog_ignore_db=information_schema
#binlog_ignore_db=mysql
#binlog_ignore_db=performation_schema
#binlog_ignore_db=sys
#binlog_do_do=
replicate_ignore_db=information_schema
replicate_ignore_db=mysql
replicate_ignore_db=performance_schema
replicate_ignore_db=sys
#replicate_do_db=

##########################
# gtid
##########################
gtid_mode = on
enforce_gtid_consistency = on

##########################
# slave parallel
##########################
slave_net_timeout=60
slave_parallel_type=LOGICAL_CLOCK
slave_parallel_workers=4

##########################
# log relay
##########################
relay_log_info_repository=TABLE
relay_log = mysql-relay-bin
relay_log_purge = on
relay_log_recovery = on
max_relay_log_size = 1G

##########################
# log error
##########################
log_error=/data/mysql/mysqld_error.log

##########################
# log slow
##########################
slow_query_log = on
slow_query_log_file = /data/mysql/mysqld_slow.log
long_query_time = 2
log_queries_not_using_indexes = on

##########################
# log general
##########################
general_log = on
general_log_file = /data/mysql/mysqld_gener.log


##########################
# thread pool,Enterprise edition
##########################
#thread_handling=pool-of-threads
#thread_handling=one-thread-per-connection
#thread_pool_oversubscribe=8 

##########################
# innodb
##########################
innodb_buffer_pool_size=2G
innodb_buffer_pool_instances=2
innodb_adaptive_flushing=on
innodb_file_per_table=1
innodb_log_file_size=1024M
innodb_log_buffer_size=64M
max_prepared_stmt_count=150000
innodb_flush_log_at_trx_commit=1
innodb_max_dirty_pages_pct=50

##########################
# password policy
# after init 
##########################
#validate_password_policy=0
#validate_password_length=4     
#validate_password_mixed_case_count=0
#validate_password_number_count=0
#validate_password_special_char_count=0

上一篇:在sql中实现取一行最大值或者最小值

栏    目:MySQL

下一篇:MySQL kill指令使用指南

本文标题:mysql 5.7 的 /etc/my.cnf 参数介绍

本文地址:https://idc91.com/shujuku/4070.html

广告投放 | 联系我们 | 免责申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

Copyright © 2023 IDC91.COM 版权所有晋ICP备17006296号