CentOS linux Mysql 5.7 配置 my.cnf
4C/8G/AliyunLinux 3 服务器配置下
> cat /etc/my.cnf
[mysqld]
port=3806
bind_address=0.0.0.0
datadir=/var/lib/mysql/data
socket=/var/lib/mysql/mysql.sock
character-set-server=utf8mb4
default-storage-engine=INNODB
autocommit=1
read_buffer_size=1024K
read_rnd_buffer_size=8M
max_connections=100
skip-name-resolve=1
max_connect_errors=100
connect_timeout=8
transaction-isolation=READ-COMMITTED
innodb_flush_log_at_trx_commit=2
explicit_defaults_for_timestamp=1
join_buffer_size=4M
tmp_table_size=4M
sort_buffer_size=4M
max_allowed_packet=4096K
innodb_page_size=8192
interactive_timeout=300
wait_timeout=300
innodb_lock_wait_timeout=60
innodb_buffer_pool_size = 2048M
long_query_time=2
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid