主页

索引

模块索引

搜索页面

文件詳細说明

  1[client]
  2port		= 3306
  3socket		= /tmp/mysql.sock
  4
  5# 查看: SHOW VARIABLES LIKE 'character%';
  6default-character-set   =   utf8    # 默认字符集
  7
  8[mysqld]
  9user        = mysql
 10port		= 3306
 11socket		= /tmp/mysql.sock
 12
 13basedir     = /usr/local/mysql-5.5.21
 14datadir     = /data/mysql/3306/data
 15pid-file    = /data/mysql/3306/mysql.pid
 16
 17#================================================
 18#   已经熟悉的参数 start
 19#================================================
 20
 21max_connections = 500   # 默认是100如果太小会造成登录失败,报"Too many connections"错误
 22max_connect_errors = 500    # 默认是10, 太小会造成‘host_name’ is blocked错误
 23
 24tmp_table_size=200M     # 默认是16M,太小会造成MySQL占CPU多
 25
 26
 27wait_timeout = 600      # 逾期時間(单位s), 太长会造成show processlist太多, 间接造成"Too many connections"错误
 28interactive_timeout = 600
 29
 30skip-name-resolve  # 
 31
 32#---日志参数----------------------------------------
 33
 34log-error = /data/mysql/3306/logs/error.log         # 错误日志参数
 35
 36#日志存放形式
 37#also can be FILE,TABLE or TABLE or NONE
 38log_output=FILE
 39
 40# 二进制日志
 41log-bin = /data/mysql/3306/logs/binlog/<log-bin>    #二进制日志参数
 42#log-bin = /data/mysql/3306/logs/binlog/master-bin    #主MySQL实例
 43binlog_cache_size = 4M
 44binlog_format = MIXED       # binlog格式MIXED, STATEMENT, ROW
 45
 46# 表示的是binlog 能够使用的最大cache 内存大小
 47max_binlog_cache_size = 8M
 48max_binlog_size = 1G
 49
 50# 慢查询日志
 51slow_query_log = 1  #是否启用慢查询日志
 52slow_query_log_file = /data/mysql/3306/logs/slow.log   # 慢查询日志, 也可以用--slow-query-log-file代替, 亦即原来的log-slow-queries选项
 53long_query_time=2                   # 慢查询时间
 54
 55# 基本日志
 56#general_log = 1 #是否开启基本日志
 57#general_log_file = /data/mysql/3306/logs/log.log             #查询日志也可以用--general-log-file代替, 亦即原来--log选项
 58
 59#log-update = /data/mysql/3306/logs/update.log   #更新日志
 60
 61#---默认的一些参数----------------------------------
 62skip-external-locking     # 
 63key_buffer_size = 384M
 64# server接受的数据包大小
 65max_allowed_packet = 1M
 66table_open_cache = 512
 67sort_buffer_size = 2M
 68read_buffer_size = 2M
 69read_rnd_buffer_size = 16M
 70myisam_sort_buffer_size = 128M
 71thread_cache_size = 8
 72
 73#【重要】 查询缓存每次对应DB发生变化都要重建索引,建议设置为0
 74query_cache_size = 32M
 75# Try number of CPU's*2 for thread_concurrency
 76thread_concurrency = 8
 77
 78
 79
 80#---innodb参数---------------------------------------
 81innodb_data_home_dir = /data/mysql/3306/data
 82innodb_data_file_path = ibdata1:10M:autoextend
 83innodb_log_group_home_dir = /data/mysql/3306/data
 84
 85# You can set .._buffer_pool_size up to 50 - 80 %
 86# of RAM but beware of setting memory usage too high
 87# 【重要】缓冲池是数据和索引缓存的地方
 88innodb_buffer_pool_size = 256M
 89
 90innodb_additional_mem_pool_size = 20M
 91
 92# Set .._log_file_size to 25 % of buffer pool size
 93#【重要】它的值和ib_logfile0和ib_logfile1的值相同,不然重启失败
 94innodb_log_file_size = 64M
 95
 96#【重要】设定每个innodb有一个数据文件
 97#set global innodb_file_per_table=ON;
 98#alter table xxx engine='innodb'; //重新生成表
 99innodb_file_per_table   = 1
100
101# 
102innodb_force_recovery = 1
103
104# 禁止域名解析
105skip_name_resolve
106
107#【重要】决定了为尚未执行的事务分配的缓存
108innodb_log_buffer_size = 8M
109#【重要】1:每次同步到磁盘,2:每秒同步一次, 0:系统崩溃时丢失数据
110innodb_flush_log_at_trx_commit = 1
111
112innodb_lock_wait_timeout = 50 # 默认50锁等待时间(超过这个时间报Lock wait timeout exceeded; try restarting transaction)
113
114#---其他参数------------------------------------------
115slow_launch_time = 1    # 这个参数跟慢查询日志没有任何关系, 它代表的是thread create的一个阈值, 如果thread create的时间超过了该值, 则变量slow_launch_threads会加1(slow_query_thread的值也是一个system overload的反映)
116#bind-address       = 127.0.0.1  #绑定ip地址
117
118
119#================================================
120#   复制用参数 start
121#================================================
122server-id = 1
123
124# binlog在每N次binlog写入后与硬盘同步
125sync_binlog = <N>
126
127#---主MySQL参数----------------------------------
128
129# 复制忽略DB
130binlog-ignore-db = mysql
131binlog-ignore-db = test
132
133# 复制指定DB
134binlog_do_db = <DB>
135
136#---从MySQL参数----------------------------------
137replicate-ignore-db = mysql
138replicate-ignore-db = test
139
140relay_log = /data/mysql/3306/logs/relaylog/<log-bin>    #从二进制日志参数
141read_only = 1      #普通用户只读选项
142
143
144# 复制用参数 end ================================
145
146
147
148
149#log-slave-updates
150
151
152# 自动删除指定天数前的binlog日志
153expire_logs_days = 7
154
155bulk_insert_buffer_size = 64M
156
157myisam_max_sort_file_size = 10G
158myisam_repair_threads = 1
159myisam_recover
160
161
162character-set-server = utf8
163
164
165[mysqldump]
166quick
167max_allowed_packet = 32M
168
169[mysql]
170no-auto-rehash
171# Remove the next comment character if you are not familiar with SQL
172#safe-updates
173
174[myisamchk]
175key_buffer_size = 256M
176sort_buffer_size = 256M
177read_buffer = 2M
178write_buffer = 2M
179
180[mysqlhotcopy]
181interactive-timeout

2014-02-20 mysql 配置:

max_connections = 5000
max_connect_errors = 30000


table_open_cache = 2048
max_allowed_packet = 16M
binlog_cache_size = 4M
max_heap_table_size = 128M
read_buffer_size = 128M
read_rnd_buffer_size = 64M
sort_buffer_size = 128M
join_buffer_size = 128M
thread_cache_size = 16
thread_concurrency = 64
query_cache_limit = 128M
ft_min_word_len = 4
thread_stack = 512K

tmp_table_size = 1024M

binlog_format=mixed

innodb_additional_mem_pool_size = 4096M
innodb_buffer_pool_size = 64G
innodb_buffer_pool_instances = 16
innodb_write_io_threads = 16
innodb_read_io_threads = 16
innodb_thread_concurrency = 64

innodb_lock_wait_timeout = 120
innodb_io_capacity = 500


innodb_page_size = 16k

主页

索引

模块索引

搜索页面