1 [mysqld] 2 basedir = /data/mysql 3 datadir = /data/mysqldata 4 tmpdir = /data/mysqltmpdata //mysql的查询临时目录,避免因为磁盘空间不足,造成相关粗偶 5 port = 3306 6 socket = /data/mysql/mysql.sock 7 init-connect=‘SET NAMES utf8‘ //连接的字符集为utf8 8 character-set-server = utf8 //系统的默认字符集为utf8 9 lower_case_table_names = 1 10 11 back_log = 1024 12 max_connections = 5000 13 max_connect_errors = 100000 14 expire_logs_days = 5 15 max_allowed_packet = 16M 16 binlog_cache_size = 5M 17 max_heap_table_size = 32M 18 tmp_table_size = 32M 19 sort_buffer_size = 8M 20 join_buffer_size = 8M 21 ft_min_word_len = 4 22 thread_stack = 254K 23 thread_cache_size = 100 24 query_cache_type = 0 25 query_cache_size = 0 26 27 28 log-bin=master-bin 29 binlog-format=ROW //二进制日志格式为ROW模式 30 log-error=/var/log/mysqld.log 31 slow_query_log = 1 32 slow-query-log-file = mysql-slow.log 33 long_query_time = 1 34 35 36 server-id = 31 37 replicate-ignore-db=test //主从复制跳过test库及相关表,以及mysql库及相关表 38 replicate-wild-ignore-table=test.% 39 replicate-ignore-db=mysql 40 replicate-wild-ignore-table=mysql.% 41 skip-slave-start 42 log_slave_updates 43 44 45 wait_timeout = 28800 46 interactive_timeout = 28800 47 skip-name-resolve=on 48 skip-external-locking 49 50 51 default-storage-engine = InnoDB 52 transaction_isolation = REPEATABLE-READ 53 innodb_buffer_pool_size = 9G //此处的值大概为系统总内存的70%-80% 54 innodb_strict_mode = 1 55 innodb_file_per_table = 1 56 innodb-open-files = 655350 57 innodb_write_io_threads=16 58 innodb_read_io_threads=16 59 innodb_thread_concurrency = 0 60 innodb_io_capacity=1000 61 innodb_flush_log_at_trx_commit = 1 62 innodb_log_buffer_size = 32M 63 innodb_log_file_size = 512M 64 innodb_log_files_in_group = 2 65 innodb_adaptive_flushing = 1 66 innodb_max_dirty_pages_pct = 90 67 innodb_lock_wait_timeout = 120 68 innodb_fast_shutdown = 0 69 innodb_flush_method = O_DIRECT 70 innodb_stats_on_metadata = 0 71 72 73 innodb_buffer_pool_instances = 8 74 sysdate-is-now 75 performance_schema 76 sql_mode=‘‘ 77 auto_increment_offset=1 //自增字段的起始值为1 78 auto_increment_increment=2 //自增的间距为2 79 80 81 [mysqldump] 82 quick 83 max_allowed_packet = 16M 84 85 [mysql] 86 default-character-set=utf8 87 pager=more 88 no-auto-rehash 89 socket = /data/mysql/mysql.sock //添加此处配置为了避免因为单独配置mysql的sock文件,造成无法使用mysql命令直接连接 90 91 [myisamchk] 92 key_buffer = 512M 93 sort_buffer_size = 512M 94 read_buffer = 8M 95 write_buffer = 8M 96 97 [mysqlhotcopy] 98 interactive-timeout 99 100 [mysqld_safe] 101 pid-file=/var/run/mysqld/mysqld.pid 102 open-files-limit = 65535 103 user = mysql
时间: 2024-10-24 23:42:06