· 6 years ago · Sep 18, 2019, 11:40 AM
1# Other default tuning values
2# MySQL Server Instance Configuration File
3# ----------------------------------------------------------------------
4# Generated by the MySQL Server Instance Configuration Wizard
5#
6#
7# Installation Instructions
8# ----------------------------------------------------------------------
9#
10# On Linux you can copy this file to /etc/my.cnf to set global options,
11# mysql-data-dir/my.cnf to set server-specific options
12# (@localstatedir@ for this installation) or to
13# ~/.my.cnf to set user-specific options.
14#
15# On Windows you should keep this file in the installation directory
16# of your server (e.g. C:\Program Files\MySQL\MySQL Server X.Y). To
17# make sure the server reads the config file use the startup option
18# "--defaults-file".
19#
20# To run the server from the command line, execute this in a
21# command line shell, e.g.
22# mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"
23#
24# To install the server as a Windows service manually, execute this in a
25# command line shell, e.g.
26# mysqld --install MySQLXY --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"
27#
28# And then execute this in a command line shell to start the server, e.g.
29# net start MySQLXY
30#
31#
32# Guidelines for editing this file
33# ----------------------------------------------------------------------
34#
35# In this file, you can use all long options that the program supports.
36# If you want to know the options a program supports, start the program
37# with the "--help" option.
38#
39# More detailed information about the individual options can also be
40# found in the manual.
41#
42# For advice on how to change settings please see
43# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
44#
45#
46# CLIENT SECTION
47# ----------------------------------------------------------------------
48#
49# The following options will be read by MySQL client applications.
50# Note that only client applications shipped by MySQL are guaranteed
51# to read this section. If you want your own MySQL client program to
52# honor these values, you need to specify it as an option during the
53# MySQL client library initialization.
54#
55[client]
56
57# pipe=
58
59# socket=MYSQL
60
61port=3307
62
63[mysql]
64no-beep
65
66# default-character-set=
67
68# SERVER SECTION
69# ----------------------------------------------------------------------
70#
71# The following options will be read by the MySQL Server. Make sure that
72# you have installed the server correctly (see above) so it reads this
73# file.
74#
75# server_type=3
76[mysqld]
77
78# The next three options are mutually exclusive to SERVER_PORT below.
79# skip-networking
80# enable-named-pipe
81# shared-memory
82
83# shared-memory-base-name=MYSQL
84
85# The Pipe the MySQL Server will use
86# socket=MYSQL
87
88# The TCP/IP Port the MySQL Server will listen on
89port=3307
90
91# Path to installation directory. All paths are usually resolved relative to this.
92# basedir="C:/Program Files/MySQL/MySQL Server 5.7/"
93
94# Path to the database root
95datadir=C:/ProgramData/MySQL/MySQL Server 5.7/Data
96
97# The default character set that will be used when a new schema or table is
98# created and no character set is defined
99# character-set-server=
100
101# The default storage engine that will be used when create new tables when
102default-storage-engine=INNODB
103
104# Set the SQL mode to strict
105sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
106
107# General and Slow logging.
108log-output=FILE
109
110general-log=0
111
112general_log_file="WYZMINDZ00625.log"
113
114#20181126 22:01 slow-query-log=1
115
116slow_query_log_file="WYZMINDZ00625-slow.log"
117
118#20181126 22:01 long_query_time=10
119
120# Binary Logging.
121# log-bin
122
123# Error Logging.
124log-error="WYZMINDZ00625.err"
125
126# Server Id.
127server-id=1
128
129# Specifies the on how table names are stored in the metadata.
130# If set to 0, will throw an error on case-insensitive operative systems
131# If set to 1, table names are stored in lowercase on disk and comparisons are not case sensitive.
132# If set to 2, table names are stored as given but compared in lowercase.
133# This option also applies to database names and table aliases.
134lower_case_table_names=1
135
136# Secure File Priv.
137secure-file-priv="C:/ProgramData/MySQL/MySQL Server 5.7/Uploads"
138
139# The maximum amount of concurrent sessions the MySQL server will
140# allow. One of these connections will be reserved for a user with
141# SUPER privileges to allow the administrator to login even if the
142# connection limit has been reached.
143# max_connections=151
144
145# The number of open tables for all threads. Increasing this value
146# increases the number of file descriptors that mysqld requires.
147# Therefore you have to make sure to set the amount of open files
148# allowed to at least 4096 in the variable "open-files-limit" in
149# section [mysqld_safe]
150# table_open_cache=2000
151
152# Maximum size for internal (in-memory) temporary tables. If a table
153# grows larger than this value, it is automatically converted to disk
154# based table This limitation is for a single table. There can be many
155# of them.
156# tmp_table_size=134M
157
158# How many threads we should keep in a cache for reuse. When a client
159# disconnects, the client's threads are put in the cache if there aren't
160# more than thread_cache_size threads from before. This greatly reduces
161# the amount of thread creations needed if you have a lot of new
162# connections. (Normally this doesn't give a notable performance
163# improvement if you have a good thread implementation.)
164# thread_cache_size=10
165
166#*** MyISAM Specific options
167# The maximum size of the temporary file MySQL is allowed to use while
168# recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE.
169# If the file-size would be bigger than this, the index will be created
170# through the key cache (which is slower).
171myisam_max_sort_file_size=128M
172
173# If the temporary file used for fast index creation would be bigger
174# than using the key cache by the amount specified here, then prefer the
175# key cache method. This is mainly used to force long character keys in
176# large tables to use the slower key cache method to create the index.
177myisam_sort_buffer_size=259M
178
179# Size of the Key Buffer, used to cache index blocks for MyISAM tables.
180# Do not set it larger than 30% of your available memory, as some memory
181# is also required by the OS to cache rows. Even if you're not using
182# MyISAM tables, you should still set it to 8-64M as it will also be
183# used for internal temporary disk tables.
184# key_buffer_size=8M
185
186# Size of the buffer used for doing full table scans of MyISAM tables.
187# Allocated per thread, if a full scan is needed.
188# read_buffer_size=64K
189
190# read_rnd_buffer_size=256K
191
192#*** INNODB Specific options ***
193# innodb_data_home_dir=
194
195# Use this option if you have a MySQL server with InnoDB support enabled
196# but you do not plan to use it. This will save memory and disk space
197# and speed up some things.
198# skip-innodb
199
200# If set to 1, InnoDB will flush (fsync) the transaction logs to the
201# disk at each commit, which offers full ACID behavior. If you are
202# willing to compromise this safety, and you are running small
203# transactions, you may set this to 0 or 2 to reduce disk I/O to the
204# logs. Value 0 means that the log is only written to the log file and
205# the log file flushed to disk approximately once per second. Value 2
206# means the log is written to the log file at each commit, but the log
207# file is only flushed to disk approximately once per second.
208innodb_flush_log_at_trx_commit=1
209
210# The size of the buffer InnoDB uses for buffering log data. As soon as
211# it is full, InnoDB will have to flush it to disk. As it is flushed
212# once per second anyway, it does not make sense to have it very large
213# (even with long transactions).
214# 20181123 20:31 innodb_log_buffer_size=1M
215
216# InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and
217# row data. The bigger you set this the less disk I/O is needed to
218# access data in tables. On a dedicated database server you may set this
219# parameter up to 80% of the machine physical memory size. Do not set it
220# too large, though, because competition of the physical memory may
221# cause paging in the operating system. Note that on 32bit systems you
222# might be limited to 2-3.5G of user level memory per process, so do not
223# set it too high.
224innodb_buffer_pool_size=30G
225
226# Size of each log file in a log group. You should set the combined size
227# of log files to about 25%-100% of your buffer pool size to avoid
228# unneeded buffer pool flush activity on log file overwrite. However,
229# note that a larger logfile size will increase the time needed for the
230# recovery process.
231innodb_log_file_size=1G
232
233# Number of threads allowed inside the InnoDB kernel. The optimal value
234# depends highly on the application, hardware as well as the OS
235# scheduler properties. A too high value may lead to thread thrashing.
236
237
238# 20181123 20:27 innodb_thread_concurrency=25
239
240# The increment size (in MB) for extending the size of an auto-extend InnoDB system tablespace file when it becomes full.
241innodb_autoextend_increment=64
242
243# The number of regions that the InnoDB buffer pool is divided into.
244# For systems with buffer pools in the multi-gigabyte range, dividing the buffer pool into separate instances can improve concurrency,
245# by reducing contention as different threads read and write to cached pages.
246innodb_buffer_pool_instances=8
247
248# Determines the number of threads that can enter InnoDB concurrently.
249# innodb_concurrency_tickets=5000
250
251# Specifies how long in milliseconds (ms) a block inserted into the old sublist must stay there after its first access before
252# it can be moved to the new sublist.
253innodb_old_blocks_time=1000
254
255# It specifies the maximum number of .ibd files that MySQL can keep open at one time. The minimum value is 10.
256# 20181123 20:28 innodb_open_files=300
257
258# When this variable is enabled, InnoDB updates statistics during metadata statements.
259innodb_stats_on_metadata=0
260
261# When innodb_file_per_table is enabled (the default in 5.6.6 and higher), InnoDB stores the data and indexes for each newly created table
262# in a separate .ibd file, rather than in the system tablespace.
263innodb_file_per_table=1
264
265# Use the following list of values: 0 for crc32, 1 for strict_crc32, 2 for innodb, 3 for strict_innodb, 4 for none, 5 for strict_none.
266innodb_checksum_algorithm=0
267
268# The number of outstanding connection requests MySQL can have.
269# This option is useful when the main MySQL thread gets many connection requests in a very short time.
270# It then takes some time (although very little) for the main thread to check the connection and start a new thread.
271# The back_log value indicates how many requests can be stacked during this short time before MySQL momentarily
272# stops answering new requests.
273# You need to increase this only if you expect a large number of connections in a short period of time.
274back_log=80
275
276# If this is set to a nonzero value, all tables are closed every flush_time seconds to free up resources and
277# synchronize unflushed data to disk.
278# This option is best used only on systems with minimal resources.
279flush_time=0
280
281# The minimum size of the buffer that is used for plain index scans, range index scans, and joins that do not use
282# indexes and thus perform full table scans.
283join_buffer_size=256K
284
285# The maximum size of one packet or any generated or intermediate string, or any parameter sent by the
286# mysql_stmt_send_long_data() C API function.
287max_allowed_packet=512M
288
289# If more than this many successive connection requests from a host are interrupted without a successful connection,
290# the server blocks that host from performing further connections.
291# max_connect_errors=100
292
293# Changes the number of file descriptors available to mysqld.
294# You should try increasing the value of this option if mysqld gives you the error "Too many open files".
295open_files_limit=4161
296
297# If you see many sort_merge_passes per second in SHOW GLOBAL STATUS output, you can consider increasing the
298# sort_buffer_size value to speed up ORDER BY or GROUP BY operations that cannot be improved with query optimization
299# or improved indexing.
300# sort_buffer_size=256K
301
302# The number of table definitions (from .frm files) that can be stored in the definition cache.
303# If you use a large number of tables, you can create a large table definition cache to speed up opening of tables.
304# The table definition cache takes less space and does not use file descriptors, unlike the normal table cache.
305# The minimum and default values are both 400.
306# table_definition_cache=1400
307
308# Specify the maximum size of a row-based binary log event, in bytes.
309# Rows are grouped into events smaller than this size if possible. The value should be a multiple of 256.
310binlog_row_event_max_size=8K
311
312# If the value of this variable is greater than 0, a replication slave synchronizes its master.info file to disk.
313# (using fdatasync()) after every sync_master_info events.
314sync_master_info=10000
315
316# If the value of this variable is greater than 0, the MySQL server synchronizes its relay log to disk.
317# (using fdatasync()) after every sync_relay_log writes to the relay log.
318sync_relay_log=10000
319
320# If the value of this variable is greater than 0, a replication slave synchronizes its relay-log.info file to disk.
321# (using fdatasync()) after every sync_relay_log_info transactions.
322sync_relay_log_info=10000
323
324# Load mysql plugins at start."plugin_x ; plugin_y".
325# plugin_load
326
327# The TCP/IP Port the MySQL Server X Protocol will listen on.
328# loose_mysqlx_port=33060
329
330
331#event scheduler
332event_scheduler=on
333
334#====================================================================
335
336# 2018-09-05
337# read_rnd_buffer_size=128K
338# from 256K to reduce handler_read_rnd_next RPS
339# 2018-09-06
340# innodb_io_capacity=1000
341# from 200 to allow additional HD RD and WD RPS(dont have this)
342# 2018-09-10
343# read_buffer_size=128K
344# from 64K to reduce handler_read_next RPS
345# 2018-09-13
346max_connections=2000
347# from 2000 because max_used_connections in 2 days was 244
348# 2018-09-14
349thread_cache_size=100
350# from 10 to conserve CPU and reduce threads_created of 339 in 2 days
351
352# 2018-09-18
353# max_heap_table_size=391M
354# from 16M to be = tmp_table_size and reduce created_tmp_disk_tables count(dont have)
355innodb_lru_scan_depth=100
356# from 1024 to reduce CPU busy every second see refman(dont have this)
357key_buffer_size=128M
358# from 512M because only 11% used today
359innodb_change_buffer_max_size=15
360 # from 25 percent because less than 1% used (dont have this)
361# 20181127 1617 innodb_flushing_avg_loops=10
362# from 30 to reduce flushing loop delay (dont have this)
363#====================================================================
364
365# 20181123-2045
366# innodb_thread_concurrency=25 # from 25 you have only 12 CORES, 2 INSTANCES on 1 SERVER, 10 is enough on EACH 5.6 & 57 NOW.
367
368# Start of Static Global Variables that will require stop/start of services to implement
369innodb_open_files=-1 # from 300 to allow autocalc = table_open_cache rather than throttled down
370# 20181126 1253 innodb_page_cleaners=8 # from 4 for 1 per IBP Instance
371innodb_log_buffer_size=16M # from 1M to support ~ 30 min logging
372# --------------------
373# have_symlink=0 # from YES to protect from ransomware attack unless you DEPEND on symlink technology
374# skip_name_resolve=1 # from OFF to reduce CONNECT delays unless REQUIRED by appl
375# --------------------
376
377innodb_read_io_threads=64 # from 4 see dba.stackexchange.com Question 5666 for details
378innodb_write_io_threads=64 # from 4 in Question 5666 see Sep 12, 2011 Rolando notes
379
380# Start of Dynamic Global Variables that may use hourly SET GLOBAL variable-name=value i.e. nn*1024*1024*1024 for K M G
381
382innodb_stats_auto_recalc=0; # from ON for query exec consistency, need ANALYZE for slow tables
383innodb_stats_persistent=0 # from ON for query exec consistency weekly use findfragtables.sql & OPTIMIZE when FREE Space > 10%
384query_prealloc_size=32K # from 8K to reduce MALLOC frequency
385query_alloc_block_size=32K # from 8K to reduce MALLOC frequency
386transaction_prealloc_size=32K # from 4K to reduce MALLOC frequency
387transaction_alloc_block_size=32K # from 8K to reduce MALLOC frequency
388
389max_connect_errors=10 # from 100 why tolerate another 99 hacker/cracker attempts?
390
391max_heap_table_size=800M # from ~400M for 1% available RAM when 2 INSTANCES running 5.6 & 5.7 on SERVER
392tmp_table_size=800M # from ~400M for 1% available RAM when 2 INSTANCES running 5.6 & 5.7 on SERVER
393
394#max_heap_table_size=200M # from ~400M for 1% available RAM when 2 INSTANCES running 5.6 & 5.7 on SERVER
395#tmp_table_size=200M # from ~400M for 1% available RAM when 2 INSTANCES running 5.6 & 5.7 on SERVER
396query_cache_size=0 # from 1M to conserve RAM when QC is OFF
397
398#table_open_cache to be increased
399table_open_cache=75000
400#table_open_cache=3000 # from 2000 to reduce opened_tables RPH of 12663
401
402table_definition_cache=1600 # from 1400 to reduce opened_table_definitions RPH of 228
403innodb_io_capacity=1600 # from 1000 to allow higher IOPS to HD
404sort_buffer_size=272K # from 256K to reduce sort_merge_passes of 10,183
405read_rnd_buffer_size=112K # from 128K to reduce handler_read_rnd_next RPS of 40808
406
407#chnages
408read_buffer_size=128M # from 128K to reduce handler_read_next RPS of 1147
409innodb_adaptive_max_sleep_delay=10000 # from 150000 for 1 second delay when busy vs 15 seconds
410max_seeks_for_key=1024 # from ~4 Billion to limit # indexes examined
411max_write_lock_count=16 # from ~4 Billion to allow RD after nn lck requests
412optimizer_search_depth=0 # from 62 to allow autocalc by optimizer and reduce search delays
413
414wait_timeout=7200 # from 28800 seconds for 2H tolerance of inactivity
415expire_logs_days=5 # from 0 for limited historical binary logs
416interactive_timeout=7200 # from 28800 seconds for 2H tolerance of inactivity
417innodb_buffer_pool_dump_pct=80 # from 25 to reduce WARM up time on start of instance
418#max_join_size=4000M # from ~4 Billion to limit joined row count
419
420
421innodb_concurrency_tickets=7500 # from 5000 to extend time allowed before REQUE
422innodb_read_ahead_threshold=8 # from 56 to RD next extent earlier
423innodb_stats_sample_pages=32 # from 8 for more accurate cardinality for OPTIMIZER
424innodb_fill_factor=85 # from 100 to avoid some index page splits
425# 20181126 1255
426innodb_page_cleaners=10 # from 8 to try to avoid page cleaners error message in windowa events
427
428# 20181126 1258
429innodb_thread_concurrency=40 # from 25 try to expedite processing
430
431# 20181127 1620 slow_query_log=OFF # rather than USUAL ON every day
432long_query_time=50000 # so NO simple slow queries are LOGGED
433min_examined_row_limit=1000 # for reducing clutter in the SLOW.LOG
434
435# 20181127 1620
436innodb_flushing_avg_loops=5 # from 10 to lower innodb_buffer_pool_pages_dirty
437slow_query_log=ON # From OFF to ON
438
439# 20181129 1853
440innodb-stats-auto-recalc=OFF; # To avoid error message at startup
441
442# 20181129 1840 from
443skip_name_resolve=ON # from OFF to minimize IP address 'nnn.74.nnn.nn' could not be resolved: