MySQL5.7 my.cnf 优化配置参数

Posted yangchunlong

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL5.7 my.cnf 优化配置参数相关的知识,希望对你有一定的参考价值。

[client]
port=3306
socket=/usr/local/web/mysql/mysql.sock
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci

skip-external-locking
skip-name-resolve

user=mysql
port=3306
basedir=/usr/local/web/mysql
datadir=/home/mysql/data
tmpdir=/home/mysql/temp
# server_id = .....
socket=/usr/local/web/mysql/mysql.sock
log-error=/home/mysql/data/mysql_error.log
pid-file=/usr/local/web/mysql/mysql.pid
open_files_limit=10240
back_log=600
max_connections=500
max_connect_errors=6000
wait_timeout=605800
#open_tables=600
#table_cache = 650
#opened_tables = 630

max_allowed_packet=32M
sort_buffer_size=4M
join_buffer_size=4M
thread_cache_size=300
query_cache_type=1
query_cache_size=256M
query_cache_limit=2M
query_cache_min_res_unit=16k

tmp_table_size=256M
max_heap_table_size=256M

key_buffer_size=256M
read_buffer_size=1M
read_rnd_buffer_size=16M
bulk_insert_buffer_size=64M

lower_case_table_names=1

default-storage-engine=INNODB

innodb_buffer_pool_size=2G
innodb_log_buffer_size=32M
innodb_log_file_size=128M
innodb_flush_method=O_DIRECT
#####################
thread_concurrency=32
long_query_time=2
slow-query-log=on
slow-query-log-file=/usr/local/web/mysql/logs/mysql-slow.log

[mysqldump]
quick
max_allowed_packet=32M

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

以上是关于MySQL5.7 my.cnf 优化配置参数的主要内容,如果未能解决你的问题,请参考以下文章

MySql5.7 配置文件 my.cnf 设置

MySql5.7配置文件my.cnf设置

MySQL5.7 my.cnf常用参数调优参数及常用语句

MySQL5.7 数据库的my.cnf配置

Linux下MySQL5.7.18二进制包安装(无默认配置文件my_default.cnf)

mysql5.7中root密码忘记后修改密码