MySQL常用配置
0
[mysqld]
server_id = 1
user = mysql
port = 3306
bind_address = 0.0.0.0
#default_time_zone = system
log_bin = mysql-bin
binlog_format = row
max_binlog_size = 2048M
expire_logs_days = 30
socket = /tmp/mysql.sock
#tmpdir = /tmp
datadir = /var/lib/mysql
#basedir = /usr/local/mysql-5.7.26
log_error = /var/lib/mysql/mysql-error.log
#pid_file = /var/run/mysqld/mysqld.pid
#log_output = file
slow_query_log = on
long_query_time = 5
slow_query_log_file = /var/lib/mysql/mysql-slow.log
log_queries_not_using_indexes = off
#general_log = off
#general_log_file = /var/lib/mysql/mysql-sql.log
collation_server = utf8mb4_general_ci
character_set_server = utf8mb4
lower_case_table_names = 1
table_open_cache = 1024
key_buffer_size = 64M
sort_buffer_size = 8M
join_buffer_size = 8M
read_buffer_size = 8M
read_rnd_buffer_size = 8M
net_buffer_length = 64K
max_allowed_packet = 16M
query_cache_size = 64M
query_cache_limit = 2M
thread_cache_size = 64
tmp_table_size = 1024M
max_heap_table_size = 1024M
max_tmp_tables = 64
max_connections = 1024
max_connect_errors = 1024
#transaction_isolation = REPEATABLE-READ
default_storage_engine = INNODB
#skip-name-resolve
[client]
port = 3306
socket = /tmp/mysql.sock
default_character_set = utf8mb4
[mysql]
no-auto-rehash
socket = /tmp/mysql.sock
default_character_set = utf8mb4
[mysqldump]
quick
max_allowed_packet = 256M
# 配置参考:https://dev.mysql.com/doc/refman/5.7/en/mysqlbinlog.html
# 配置参考:https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html