mysql8配置文件优化_2018_lcf

版本一

[mysqld]
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
datadir         = /var/lib/mysql

# 日志相关
slow_query_log=ON
log_error ="/var/lib/mysql/log/error.log"
slow_query_log_file="/var/lib/mysql/log/blg-slow.log"
long_query_time=2
log_queries_not_using_indexes = 1
log_throttle_queries_not_using_indexes = 10
expire_logs_days = 90
min_examined_row_limit = 100
log_output=TABLE,FILE
general_log=1

# binlog设置 
master_info_repository = TABLE
relay_log_info_repository = TABLE
log_bin = bin.log
server-id=150

# innodb 设置
default_storage_engine = InnoDB
innodb_file_per_table = 1
innodb_open_files = 500
innodb_buffer_pool_size = 1024M
innodb_write_io_threads = 4
innodb_read_io_threads = 4
innodb_thread_concurrency = 0
innodb_purge_threads = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 2M
innodb_log_file_size = 32M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_buffer_pool_load_at_startup = 1
innodb_buffer_pool_dump_at_shutdown = 1
innodb_lru_scan_depth = 2000
innodb_io_capacity = 4000
innodb_io_capacity_max = 8000

# 默认参数设置
secure-file-priv= NULL
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
default_authentication_plugin=mysql_native_password
sql_mode='NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES'
# # Custom config should go here
!includedir /etc/mysql/conf.d/


#----------------优化配置(说明从上到下)
# 支持符号链接,就是可以通过软连接的方式,管理其他目录的数据库,最好不要开启,当一个磁盘或分区空间不够时,可以开启该参数将数据存储到其他的磁盘或分区
symbolic-links=0
# 设置autocommit=0,则用户将一直处于某个事务中,直到执行一条commit提交或rollback语句才会结束当前事务重新开始一个新的事务(调试模式时使用)
#autocommit=0
# MySQL读入缓冲区的大小
read_buffer_size = 16M
# MySQL的随机读缓冲区大小、MySQL的顺序读缓冲区大小
read_rnd_buffer_size = 8M
sort_buffer_size = 8M
# 连接超时时间、保持时间、最大传输数据包大小
wait_timeout=2880000
interactive_timeout=2880000
max_allowed_packet=100M
# 连接缓存池大小、临时表大小、临时存放位置
join_buffer_size = 128M
tmp_table_size = 64M
tmpdir = /tmp

 

你可能感兴趣的:(mysql,优化篇(系统,网络,程序))