2
#DESCR: 4GB RAM, InnoDB only, ACID, few connections, heavy queries
7
# This is a MySQL example config file for systems with 4GB of memory
8
# running mostly MySQL using InnoDB only tables and performing complex
9
# queries with few connections.
11
# You can copy this file to /etc/my.cnf to set global options,
12
# mysql-data-dir/my.cnf to set server-specific options
13
# (@localstatedir@ for this installation) or to
14
# ~/.my.cnf to set user-specific options.
16
# In this file, you can use all long options that a program supports.
17
# If you want to know which options a program supports, run the program
18
# with the "--help" option.
20
# More detailed information about the individual options can also be
21
# found in the manual.
25
# The following options will be read by MySQL client applications.
26
# Note that only client applications shipped by MySQL are guaranteed
27
# to read this section. If you want your own MySQL client program to
28
# honor these values, you need to specify it as an option during the
29
# MySQL client library initialization.
32
#password = [your_password]
33
port = @MYSQL_TCP_PORT@
34
socket = @MYSQL_UNIX_ADDR@
36
# *** Application-specific options follow here ***
43
# generic configuration options
44
port = @MYSQL_TCP_PORT@
45
socket = @MYSQL_UNIX_ADDR@
47
# back_log is the number of connections the operating system can keep in
48
# the listen queue, before the MySQL connection manager thread has
49
# processed them. If you have a very high connection rate and experience
50
# "connection refused" errors, you might need to increase this value.
51
# Check your OS documentation for the maximum value of this parameter.
52
# Attempting to set back_log higher than your operating system limit
53
# will have no effect.
56
# Don't listen on a TCP/IP port at all. This can be a security
57
# enhancement, if all processes that need to connect to mysqld run
58
# on the same host. All interaction with mysqld must be made via Unix
59
# sockets or named pipes.
60
# Note that using this option without enabling named pipes on Windows
61
# (via the "enable-named-pipe" option) will render mysqld useless!
64
# The maximum amount of concurrent sessions the MySQL server will
65
# allow. One of these connections will be reserved for a user with
66
# SUPER privileges to allow the administrator to login even if the
67
# connection limit has been reached.
70
# Maximum amount of errors allowed per host. If this limit is reached,
71
# the host will be blocked from connecting to the MySQL server until
72
# "FLUSH HOSTS" has been run or the server was restarted. Invalid
73
# passwords and other errors during the connect phase result in
74
# increasing this value. See the "Aborted_connects" status variable for
76
max_connect_errors = 10
78
# The number of open tables for all threads. Increasing this value
79
# increases the number of file descriptors that mysqld requires.
80
# Therefore you have to make sure to set the amount of open files
81
# allowed to at least 4096 in the variable "open-files-limit" in
82
# section [mysqld_safe]
85
# Enable external file level locking. Enabled file locking will have a
86
# negative impact on performance, so only use it in case you have
87
# multiple database instances running on the same files (note some
88
# restrictions still apply!) or if you use other software relying on
89
# locking MyISAM tables on file level.
92
# The maximum size of a query packet the server can handle as well as
93
# maximum query size server can process (Important when working with
94
# large BLOBs). enlarged dynamically, for each connection.
95
max_allowed_packet = 16M
97
# The size of the cache to hold the SQL statements for the binary log
98
# during a transaction. If you often use big, multi-statement
99
# transactions you can increase this value to get more performance. All
100
# statements from transactions are buffered in the binary log cache and
101
# are being written to the binary log at once after the COMMIT. If the
102
# transaction is larger than this value, temporary file on disk is used
103
# instead. This buffer is allocated per connection on first update
104
# statement in transaction
105
binlog_cache_size = 1M
107
# Maximum allowed size for a single HEAP (in memory) table. This option
108
# is a protection against the accidential creation of a very large HEAP
109
# table which could otherwise use up all memory resources.
110
max_heap_table_size = 64M
112
# Sort buffer is used to perform sorts for some ORDER BY and GROUP BY
113
# queries. If sorted data does not fit into the sort buffer, a disk
114
# based merge sort is used instead - See the "Sort_merge_passes"
115
# status variable. Allocated per thread if sort is needed.
116
sort_buffer_size = 8M
118
# This buffer is used for the optimization of full JOINs (JOINs without
119
# indexes). Such JOINs are very bad for performance in most cases
120
# anyway, but setting this variable to a large value reduces the
121
# performance impact. See the "Select_full_join" status variable for a
122
# count of full JOINs. Allocated per thread if full join is found
123
join_buffer_size = 8M
125
# How many threads we should keep in a cache for reuse. When a client
126
# disconnects, the client's threads are put in the cache if there aren't
127
# more than thread_cache_size threads from before. This greatly reduces
128
# the amount of thread creations needed if you have a lot of new
129
# connections. (Normally this doesn't give a notable performance
130
# improvement if you have a good thread implementation.)
131
thread_cache_size = 8
133
# This permits the application to give the threads system a hint for the
134
# desired number of threads that should be run at the same time. This
135
# value only makes sense on systems that support the thread_concurrency()
136
# function call (Sun Solaris, for example).
137
# You should try [number of CPUs]*(2..4) for thread_concurrency
138
thread_concurrency = 8
140
# Query cache is used to cache SELECT results and later return them
141
# without actual executing the same query once again. Having the query
142
# cache enabled may result in significant speed improvements, if your
143
# have a lot of identical queries and rarely changing tables. See the
144
# "Qcache_lowmem_prunes" status variable to check if the current value
145
# is high enough for your load.
146
# Note: In case your tables change very often or if your queries are
147
# textually different every time, the query cache may result in a
148
# slowdown instead of a performance improvement.
149
query_cache_size = 64M
151
# Only cache result sets that are smaller than this limit. This is to
152
# protect the query cache of a very large result set overwriting all
153
# other query results.
154
query_cache_limit = 2M
156
# Minimum word length to be indexed by the full text search index.
157
# You might wish to decrease it if you need to search for shorter words.
158
# Note that you need to rebuild your FULLTEXT index, after you have
159
# modified this value.
162
# If your system supports the memlock() function call, you might want to
163
# enable this option while running MySQL to keep it locked in memory and
164
# to avoid potential swapping out in case of high memory pressure. Good
168
# Table type which is used by default when creating new tables, if not
169
# specified differently during the CREATE TABLE statement.
170
default_table_type = MYISAM
172
# Thread stack size to use. This amount of memory is always reserved at
173
# connection time. MySQL itself usually needs no more than 64K of
174
# memory, while if you use your own stack hungry UDF functions or your
175
# OS requires more stack for some operations, you might need to set this
179
# Set the default transaction isolation level. Levels available are:
180
# READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ, SERIALIZABLE
181
transaction_isolation = REPEATABLE-READ
183
# Maximum size for internal (in-memory) temporary tables. If a table
184
# grows larger than this value, it is automatically converted to disk
185
# based table This limitation is for a single table. There can be many
189
# Enable binary logging. This is required for acting as a MASTER in a
190
# replication configuration. You also need the binary log if you need
191
# the ability to do point in time recovery from your latest backup.
194
# If you're using replication with chained slaves (A->B->C), you need to
195
# enable this option on server B. It enables logging of updates done by
196
# the slave thread into the slave's binary log.
199
# Enable the full query log. Every query (even ones with incorrect
200
# syntax) that the server receives will be logged. This is useful for
201
# debugging, it is usually disabled in production use.
204
# Print warnings to the error log file. If you have any problem with
205
# MySQL you should enable logging of warnings and examine the error log
206
# for possible explanations.
209
# Log slow queries. Slow queries are queries which take more than the
210
# amount of time defined in "long_query_time" or which do not use
211
# indexes well, if log_long_format is enabled. It is normally good idea
212
# to have this turned on if you frequently add new queries to the
216
# All queries taking more than this amount of time (in seconds) will be
217
# trated as slow. Do not use "1" as a value here, as this will result in
218
# even very fast queries being logged from time to time (as MySQL
219
# currently measures time with second accuracy only).
222
# Log more information in the slow query log. Normally it is good to
223
# have this turned on. This will enable logging of queries that are not
224
# using indexes in addition to long running queries.
227
# The directory used by MySQL for storing temporary files. For example,
228
# it is used to perform disk based large sorts, as well as for internal
229
# and explicit temporary tables. It might be good to put it on a
230
# swapfs/tmpfs filesystem, if you do not create very large temporary
231
# files. Alternatively you can put it on dedicated disk. You can
232
# specify multiple paths here by separating them by ";" - they will then
233
# be used in a round-robin fashion.
237
# *** Replication related settings
240
# Unique server identification number between 1 and 2^32-1. This value
241
# is required for both master and slave hosts. It defaults to 1 if
242
# "master-host" is not set, but will MySQL will not function as a master
246
# Replication Slave (comment out master section to use this)
248
# To configure this host as a replication slave, you can choose between
251
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
254
# CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
255
# MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
257
# where you replace <host>, <user>, <password> by quoted strings and
258
# <port> by the master's port number (3306 by default).
262
# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
263
# MASTER_USER='joe', MASTER_PASSWORD='secret';
267
# 2) Set the variables below. However, in case you choose this method, then
268
# start replication for the first time (even unsuccessfully, for example
269
# if you mistyped the password in master-password and the slave fails to
270
# connect), the slave will create a master.info file, and any later
271
# changes in this file to the variable values below will be ignored and
272
# overridden by the content of the master.info file, unless you shutdown
273
# the slave server, delete master.info and restart the slaver server.
274
# For that reason, you may want to leave the lines below untouched
275
# (commented) and instead use CHANGE MASTER TO (see above)
277
# required unique id between 2 and 2^32 - 1
278
# (and different from the master)
279
# defaults to 2 if master-host is set
280
# but will not function as a slave if omitted
283
# The replication master for this slave - required
284
#master-host = <hostname>
286
# The username the slave will use for authentication when connecting
287
# to the master - required
288
#master-user = <username>
290
# The password the slave will authenticate with when connecting to
291
# the master - required
292
#master-password = <password>
294
# The port the master is listening on.
295
# optional - defaults to 3306
296
#master-port = <port>
298
# Make the slave read-only. Only users with the SUPER privilege and the
299
# replication slave thread will be able to modify data on it. You can
300
# use this to ensure that no applications will accidently modify data on
301
# the slave instead of the master
305
#*** MyISAM Specific options
308
# Size of the Key Buffer, used to cache index blocks for MyISAM tables.
309
# Do not set it larger than 30% of your available memory, as some memory
310
# is also required by the OS to cache rows. Even if you're not using
311
# MyISAM tables, you should still set it to 8-64M as it will also be
312
# used for internal temporary disk tables.
313
key_buffer_size = 32M
315
# Size of the buffer used for doing full table scans of MyISAM tables.
316
# Allocated per thread, if a full scan is needed.
317
read_buffer_size = 2M
319
# When reading rows in sorted order after a sort, the rows are read
320
# through this buffer to avoid disk seeks. You can improve ORDER BY
321
# performance a lot, if set this to a high value.
322
# Allocated per thread, when needed.
323
read_rnd_buffer_size = 16M
325
# MyISAM uses special tree-like cache to make bulk inserts (that is,
326
# INSERT ... SELECT, INSERT ... VALUES (...), (...), ..., and LOAD DATA
327
# INFILE) faster. This variable limits the size of the cache tree in
328
# bytes per thread. Setting it to 0 will disable this optimisation. Do
329
# not set it larger than "key_buffer_size" for optimal performance.
330
# This buffer is allocated when a bulk insert is detected.
331
bulk_insert_buffer_size = 64M
333
# This buffer is allocated when MySQL needs to rebuild the index in
334
# REPAIR, OPTIMIZE, ALTER table statements as well as in LOAD DATA INFILE
335
# into an empty table. It is allocated per thread so be careful with
337
myisam_sort_buffer_size = 128M
339
# The maximum size of the temporary file MySQL is allowed to use while
340
# recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE.
341
# If the file-size would be bigger than this, the index will be created
342
# through the key cache (which is slower).
343
myisam_max_sort_file_size = 10G
345
# If the temporary file used for fast index creation would be bigger
346
# than using the key cache by the amount specified here, then prefer the
347
# key cache method. This is mainly used to force long character keys in
348
# large tables to use the slower key cache method to create the index.
349
myisam_max_extra_sort_file_size = 10G
351
# If a table has more than one index, MyISAM can use more than one
352
# thread to repair them by sorting in parallel. This makes sense if you
353
# have multiple CPUs and plenty of memory.
354
myisam_repair_threads = 1
356
# Automatically check and repair not properly closed MyISAM tables.
360
# *** INNODB Specific options ***
362
# Use this option if you have a MySQL server with InnoDB support enabled
363
# but you do not plan to use it. This will save memory and disk space
364
# and speed up some things.
367
# Additional memory pool that is used by InnoDB to store metadata
368
# information. If InnoDB requires more memory for this purpose it will
369
# start to allocate it from the OS. As this is fast enough on most
370
# recent operating systems, you normally do not need to change this
371
# value. SHOW INNODB STATUS will display the current amount used.
372
innodb_additional_mem_pool_size = 16M
374
# InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and
375
# row data. The bigger you set this the less disk I/O is needed to
376
# access data in tables. On a dedicated database server you may set this
377
# parameter up to 80% of the machine physical memory size. Do not set it
378
# too large, though, because competition of the physical memory may
379
# cause paging in the operating system. Note that on 32bit systems you
380
# might be limited to 2-3.5G of user level memory per process, so do not
382
innodb_buffer_pool_size = 2G
384
# InnoDB stores data in one or more data files forming the tablespace.
385
# If you have a single logical drive for your data, a single
386
# autoextending file would be good enough. In other cases, a single file
387
# per device is often a good choice. You can configure InnoDB to use raw
388
# disk partitions as well - please refer to the manual for more info
390
innodb_data_file_path = ibdata1:10M:autoextend
392
# Set this option if you would like the InnoDB tablespace files to be
393
# stored in another location. By default this is the MySQL datadir.
394
#innodb_data_home_dir = <directory>
396
# Number of IO threads to use for async IO operations. This value is
397
# hardcoded to 4 on Unix, but on Windows disk I/O may benefit from a
399
innodb_file_io_threads = 4
401
# If you run into InnoDB tablespace corruption, setting this to a nonzero
402
# value will likely help you to dump your tables. Start from value 1 and
403
# increase it until you're able to dump the table successfully.
404
#innodb_force_recovery=1
406
# Number of threads allowed inside the InnoDB kernel. The optimal value
407
# depends highly on the application, hardware as well as the OS
408
# scheduler properties. A too high value may lead to thread thrashing.
409
innodb_thread_concurrency = 16
411
# If set to 1, InnoDB will flush (fsync) the transaction logs to the
412
# disk at each commit, which offers full ACID behavior. If you are
413
# willing to compromise this safety, and you are running small
414
# transactions, you may set this to 0 or 2 to reduce disk I/O to the
415
# logs. Value 0 means that the log is only written to the log file and
416
# the log file flushed to disk approximately once per second. Value 2
417
# means the log is written to the log file at each commit, but the log
418
# file is only flushed to disk approximately once per second.
419
innodb_flush_log_at_trx_commit = 1
421
# Speed up InnoDB shutdown. This will disable InnoDB to do a full purge
422
# and insert buffer merge on shutdown. It may increase shutdown time a
423
# lot, but InnoDB will have to do it on the next startup instead.
424
#innodb_fast_shutdown
426
# The size of the buffer InnoDB uses for buffering log data. As soon as
427
# it is full, InnoDB will have to flush it to disk. As it is flushed
428
# once per second anyway, it does not make sense to have it very large
429
# (even with long transactions).
430
innodb_log_buffer_size = 8M
432
# Size of each log file in a log group. You should set the combined size
433
# of log files to about 25%-100% of your buffer pool size to avoid
434
# unneeded buffer pool flush activity on log file overwrite. However,
435
# note that a larger logfile size will increase the time needed for the
437
innodb_log_file_size = 256M
439
# Total number of files in the log group. A value of 2-3 is usually good
441
innodb_log_files_in_group = 3
443
# Location of the InnoDB log files. Default is the MySQL datadir. You
444
# may wish to point it to a dedicated hard drive or a RAID1 volume for
445
# improved performance
446
#innodb_log_group_home_dir
448
# Maximum allowed percentage of dirty pages in the InnoDB buffer pool.
449
# If it is reached, InnoDB will start flushing them out agressively to
450
# not run out of clean pages at all. This is a soft limit, not
451
# guaranteed to be held.
452
innodb_max_dirty_pages_pct = 90
454
# The flush method InnoDB will use for Log. The tablespace always uses
455
# doublewrite flush logic. The default value is "fdatasync", another
456
# option is "O_DSYNC".
457
#innodb_flush_method=O_DSYNC
459
# How long an InnoDB transaction should wait for a lock to be granted
460
# before being rolled back. InnoDB automatically detects transaction
461
# deadlocks in its own lock table and rolls back the transaction. If you
462
# use the LOCK TABLES command, or other transaction-safe storage engines
463
# than InnoDB in the same transaction, then a deadlock may arise which
464
# InnoDB cannot notice. In cases like this the timeout is useful to
465
# resolve the situation.
466
innodb_lock_wait_timeout = 120
470
# Do not buffer the whole result set in memory before writing it to
471
# file. Required for dumping very large tables
474
max_allowed_packet = 16M
479
# Only allow UPDATEs and DELETEs that use keys.
484
sort_buffer_size = 512M
490
sort_buffer_size = 512M
498
# Increase the amount of open files allowed per process. Warning: Make
499
# sure you have set the global system limit high enough! The high value
500
# is required for a large number of opened tables
501
open-files-limit = 8192