根据系统配置参数不同配置文件配置不同
5.7.19和5.7.26可使用该配置文件亲测有效
虚拟机机器配置如下
查看每个物理CPU中core的个数(既核数):
[root@cdh02 softword]# cat /proc/cpuinfo| grep "cpu cores"| uniq
cpu cores : 1
查查物理cpu个数:
[root@cdh02 softword]# cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
1
查看逻辑CPU的个数:
[root@cdh02 softword]# cat /proc/cpuinfo| grep "processor"| wc -l
1
配置文件内容如下:
使用时去掉“注释”
[mysqld_multi]
mysqld = /usr/bin/mysqld_safe
user = mysql
log = /data/multi.log
[client]
注释#default-character-set=utf8
[mysqld@3307]
注释#*****common parameters
skip-federated
skip-blackhole
performance_schema=0
default-storage-engine=InnoDB
sql_mode=STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION
secure-file-priv=/
log-bin-trust-function-creators=1
注释#default-character-set=utf8
character_set_server=utf8
注释#collation_server=utf8_general_ci
server_id=16201
user=mysql
port=3307
pid-file=/data/mysqldata3307/sock/mysql.pid
socket=/data/mysqldata3307/sock/mysql.sock
注释#replicate_do_db=v_traffic_deal
datadir=/data/mysqldata3307/mydata
tmpdir=/data/mysqldata3307/tmpdir
skip-name-resolve
skip_external_locking
group_concat_max_len=1048576
flush=OFF
lower_case_table_names=1
event-scheduler=ON
back_log=500
log_bin_trust_function_creators=ON
log_slave_updates=ON
max_connections=8000
max_connect_errors=99999
max_allowed_packet=64M
max_heap_table_size=512M
tmp_table_size=256M
max_length_for_sort_data=16k
wait_timeout=172800
interactive_timeout=172800
net_buffer_length=8K
read_buffer_size=2M
read_rnd_buffer_size=4M
sort_buffer_size=8M
join_buffer_size=16M
table_open_cache=1024
thread_cache_size=1024
query_cache_type=0
注释#query_cache_size=128M
注释#query_cache_limit=10M
注释#******************************* Logs related settings ***************************
注释#general_log
注释#general_log_file=/data/mysqldata3408/log/general.log
log-error=/data/mysqldata3307/log/error.log
long_query_time=1
slow_query_log
slow_query_log_file=/data/mysqldata3307/log/slow-query.log
log_queries_not_using_indexes
log_warnings = 2
log-bin=/data/mysqldata3307/binlog/mysql-bin
relay-log=/data/mysqldata3307/relaylog/mysql-relay-bin
binlog_cache_size=2M
max_binlog_size=512M
sync_binlog=0
expire_logs_days=7
binlog_format=ROW
注释#bind-address=0.0.0.0
注释#******************************* MyISAM Specific options ****************************
key_buffer_size=512M
bulk_insert_buffer_size=16M
myisam_sort_buffer_size=64M
myisam_max_sort_file_size=8G
myisam_repair_threads=1
myisam_recover_options=force,backup
注释#***************************** INNODB Specific options ****************************
innodb_file_per_table
plugin-innodb_file_per_table
innodb_open_files=7168
innodb_buffer_pool_size=2G
innodb_buffer_pool_instances=8
innodb_data_home_dir=/data/mysqldata3307/innodb_ts
innodb_data_file_path=ibdata1:4096M:autoextend
innodb_autoextend_increment=128
innodb_thread_concurrency=0
innodb_flush_log_at_trx_commit=2
innodb_fast_shutdown=1
innodb_force_recovery=0
innodb_log_buffer_size=1M
innodb_log_file_size=128M
innodb_log_files_in_group=2
innodb_log_group_home_dir=/data/mysqldata3307/innodb_log
innodb_max_dirty_pages_pct=60
innodb_purge_threads=0
注释#foreign_key_checks=0
innodb_lock_wait_timeout=120
innodb_rollback_on_timeout=1
注释#skip-innodb_doublewrite
innodb_flush_method=O_DIRECT
innodb_commit_concurrency=0
innodb_thread_concurrency=0
innodb_concurrency_tickets=1024
innodb_autoinc_lock_mode=2
innodb_change_buffering=all
注释#innodb plugin
innodb_read_io_threads=32
innodb_write_io_threads=16
innodb_io_capacity=200
innodb_file_format=Barracuda
innodb_file_format_check=1
innodb_strict_mode=1
innodb_stats_on_metadata=0
innodb_support_xa=1
[mysqldump]
quick
max_allowed_packet=2G
default-character-set=utf8
[mysql]
no-auto-rehash
prompt="u@h : d
:m:s> "
default-character-set=utf8
show-warnings
注释#pager=mk-visual-explain
[myisamchk]
key_buffer=512M
sort_buffer_size=512M
read_buffer=8M
write_buffer=8M
[mysqlhotcopy]
interactive-timeout
[mysqld_safe]
user=mysql
open-files-limit=8192