mysql配置文件优化

[mysqld]
user=mysql
port = 3306
basedir=/usr/local/mysql
datadir=/home/mysql/data
pid-file=/usr/local/mysql/data/localhost.localdomain.pid
log-error=/usr/local/mysql/data/localhost.localdomain.err
character_set_server = utf8mb4
collation-server = utf8mb4
open_files_limit = 20480

#engine
default-storage-engine = InnoDB
transaction_isolation = READ-COMMITTED

#connections
skip-name-resolve
max_connections = 6000
max_user_connections = 0
max_connect_errors = 100000
max_allowed_packet = 32M
back_log = 2048
interactive_timeout=7200
key_buffer_size=2G

#cache
query_cache_type=1
query_cache_size=2G
query_cache_limit = 16M
read_buffer_size=2M
read_rnd_buffer_size=8M
bulk_insert_buffer_size=64M
sort_buffer_size=8M
join_buffer_size=16M
table_cache=65535
#tmpdir=/home/tmp
tmp_table_size = 8M
max_heap_table_size = 8M

#log-bin = /home/mysql/logs/mysql-bin.log
#expire-logs-days = 14
#binlog_format="row"
#max-binlog-size = 500M
#server-id = 1

plugin-dir=/usr/local/mysql/lib/plugin
thread_cache_size = 1024
thread_concurrency = 64
wait_timeout = 60

#innodb
innodb_buffer_pool_size = 128G
innodb_flush_log_at_trx_commit = 1
innodb_additional_mem_pool_size = 64M
innodb_thread_concurrency = 0
#innodb_data_file_path = ibdata1:1024M:autoextend
innodb_flush_method = O_DIRECT
innodb_file_per_table = 1
innodb_read_io_threads = 16
innodb_write_io_threads = 16
innodb_open_files = 1200
innodb_io_capacity = 2000
innodb_io_capacity_max = 6000
innodb_lru_scan_depth = 2000

innodb_max_dirty_pages_pct = 80
innodb_lock_wait_timeout = 120
innodb_log_files_in_group = 4
innodb_log_buffer_size = 256M
innodb_log_file_size = 4G
innodb_page_size = 16k
#long_query_time = 10
#slow_query_log = 1
#slow_query_log_file = /home/tmp/localhost-slow.log
lower_case_table_names = 1

#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
sql_mode="STRICT_TRANS_TABLES,
ERROR_FOR_DIVISION_BY_ZERO,
NO_AUTO_CREATE_USER,
NO_AUTO_VALUE_ON_ZERO,
NO_ENGINE_SUBSTITUTION,
NO_ZERO_DATE,
NO_ZERO_IN_DATE,
ONLY_FULL_GROUP_BY"

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

猜你喜欢

转载自www.cnblogs.com/aywangzhao/p/12753920.html
今日推荐