linux系统中mysql的配置文件在/etc/my.cnf里面,配置内容如下
[client]
port = 3306
socket = /usr/local/mysql/data/mysql.sock
[mysqld]
skip_name_resolve = 1
skip_external_locking = 1
skip_symbolic_links = 1
user = mysql
default_storage_engine = InnoDB
character-set-server = utf8
pid_file = /usr/local/mysql/data/mysqld.pid
basedir = /usr/local/mysql
port = 3306
bind-address = 0.0.0.0
explicit_defaults_for_timestamp = off
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
key_buffer_size = 32M
innodb_undo_directory = /usr/local/mysql/undo
innodb_undo_tablespaces = 8
max_allowed_packet = 100M
max_connect_errors = 1000000
sysdate_is_now = 1
secure-file-priv = '/tmp'
default_authentication_plugin='mysql_native_password'
server-id = 1001
relay_log = mysqld-relay-bin
gtid_mode = on
enforce-gtid-consistency
log-slave-updates = on
master_info_repository = TABLE
relay_log_info_repository = TABLE
datadir = /usr/local/mysql/data/
tmpdir = /tmp
log_bin = /usr/local/mysql/sql_log/mysql-bin
max_binlog_size = 1000M
binlog_format = row
binlog_expire_logs_seconds=86400
tmp_table_size = 32M
max_heap_table_size = 32M
max_connections = 4000
thread_cache_size = 2048
open_files_limit = 65535
table_definition_cache = 4096
table_open_cache = 4096
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 2M
join_buffer_size = 1M
thread_stack = 512k
max_length_for_sort_data = 16k
innodb_flush_method = O_DIRECT
innodb_log_buffer_size = 16M
innodb_flush_log_at_trx_commit = 2
innodb_file_per_table = 1
innodb_buffer_pool_size = 256M
innodb_stats_on_metadata = off
innodb_open_files = 8192
innodb_read_io_threads = 16
innodb_write_io_threads = 16
innodb_io_capacity = 20000
innodb_thread_concurrency = 0
innodb_lock_wait_timeout = 60
innodb_old_blocks_time = 1000
innodb_use_native_aio = 1
innodb_purge_threads = 1
innodb_change_buffering = all
innodb_log_file_size = 64M
innodb_log_files_in_group = 2
innodb_data_file_path = ibdata1:256M:autoextend
innodb_rollback_on_timeout = on
log_error = /usr/local/mysql/sql_log/mysql-error.log
slow_query_log_file = /usr/local/mysql/sql_log/slowlog.log