linux-tutorial/codes/linux/soft/config/mysql/my.cnf

49 lines
1.4 KiB
Plaintext
Raw Normal View History

# -------------------------------------------------------------------------------
# Mysql 基本配置模板
# -------------------------------------------------------------------------------
2019-11-26 17:11:53 +08:00
[mysqld]
# GENERAL
# -------------------------------------------------------------------------------
server_id = 2
2019-11-26 17:11:53 +08:00
datadir = /var/lib/mysql
socket = /var/lib/mysql/mysql.sock
pid_file = /var/lib/mysql/mysql.pid
user = mysql
port = 3306
default_storage_engine = InnoDB
default_time_zone = '+8:00'
character_set_server = utf8mb4
collation_server = utf8mb4_0900_ai_ci
2019-11-26 17:11:53 +08:00
# LOG
# -------------------------------------------------------------------------------
log_error = /var/log/mysql/mysql-error.log
slow_query_log = 1
slow_query_log_file = /var/log/mysql/mysql-slow.log
long_query_time = 3
min_examined_row_limit = 100
expire_logs_days = 7
2019-11-26 17:11:53 +08:00
# InnoDB
2019-11-26 17:11:53 +08:00
# -------------------------------------------------------------------------------
innodb_buffer_pool_size = 4G
innodb_log_file_size = 128M
innodb_file_per_table = 1
innodb_flush_method = O_DIRECT
2019-11-26 17:11:53 +08:00
# MyIsam
# -------------------------------------------------------------------------------
key_buffer_size = 256M
2019-11-26 17:11:53 +08:00
# OTHER
2019-11-26 17:11:53 +08:00
# -------------------------------------------------------------------------------
tmp_table_size = 32M
max_heap_table_size = 32M
max_connections = 10000
open_files_limit = 65535
[client]
socket = /var/lib/mysql/mysql.sock
port = 3306