MySQL配置文件简单解析

[mysqld]
basedir         = /data/mysql
datadir         = /data/mysqldata
tmpdir        = /data/mysqltmpdata  //mysql的查询临时目录,避免因为磁盘空间不足,造成相关粗偶
port            = 3306
socket          = /data/mysql/mysql.sock
init-connect='SET NAMES utf8'  //连接的字符集为utf8
character-set-server = utf8  //系统的默认字符集为utf8
lower_case_table_names  = 1

back_log = 1024
max_connections = 5000
max_connect_errors = 100000
expire_logs_days = 5
max_allowed_packet = 16M
binlog_cache_size = 5M
max_heap_table_size     = 32M
tmp_table_size          = 32M
sort_buffer_size = 8M
join_buffer_size = 8M
ft_min_word_len = 4
thread_stack = 254K
thread_cache_size = 100
query_cache_type = 0
query_cache_size = 0


log-bin=master-bin
binlog-format=ROW  //二进制日志格式为ROW模式
log-error=/var/log/mysqld.log
slow_query_log = 1
slow-query-log-file = mysql-slow.log
long_query_time = 1


server-id = 31
replicate-ignore-db=test  //主从复制跳过test库及相关表,以及mysql库及相关表
replicate-wild-ignore-table=test.%
replicate-ignore-db=mysql
replicate-wild-ignore-table=mysql.%
skip-slave-start
log_slave_updates


wait_timeout = 28800
interactive_timeout = 28800
skip-name-resolve=on
skip-external-locking


default-storage-engine = InnoDB
transaction_isolation = REPEATABLE-READ
innodb_buffer_pool_size = 9G    //此处的值大概为系统总内存的70%-80%
innodb_strict_mode = 1
innodb_file_per_table = 1
innodb-open-files = 655350
innodb_write_io_threads=16
innodb_read_io_threads=16
innodb_thread_concurrency = 0
innodb_io_capacity=1000
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 32M
innodb_log_file_size = 512M
innodb_log_files_in_group = 2
innodb_adaptive_flushing = 1
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_fast_shutdown = 0
innodb_flush_method  = O_DIRECT
innodb_stats_on_metadata = 0


innodb_buffer_pool_instances = 8
sysdate-is-now
performance_schema
sql_mode=''
auto_increment_offset=1  //自增字段的起始值为1
auto_increment_increment=2  //自增的间距为2


[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
default-character-set=utf8
pager=more
no-auto-rehash
socket          = /data/mysql/mysql.sock //添加此处配置为了避免因为单独配置mysql的sock文件,造成无法使用mysql命令直接连接

[myisamchk]
key_buffer = 512M
sort_buffer_size = 512M
read_buffer = 8M
write_buffer = 8M

[mysqlhotcopy]
interactive-timeout

[mysqld_safe]
pid-file=/var/run/mysqld/mysqld.pid
open-files-limit = 65535
user = mysql
 

 

posted @ 2017-06-23 22:14  运维小兵  阅读(460)  评论(0编辑  收藏  举报