Detailed parameters of mysql 5.5

[mysql]
default-character-set=utf8

[mysqld]

datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

bind-address = 0.0.0.0
port = 3306

init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-client=utf8
character-set-server=utf8
collation-server=utf8_unicode_ci


server-id = 1 # indicates a number of the machine 1, is the general meaning of the master

Resolve-name-Skip
# MySQL is prohibited to connect external DNS resolution, use this option eliminates MySQL DNS resolution time. Note, however, if this option is turned on,
# all authorized remote host connection have to use IP address mode, or MySQL can not handle the normal connection request

#skip-networking

= 600 back_log
# number of connections MySQL can some. When the main MySQL thread in a very short period of time a lot of connection requests, which play a role,
# main thread then spend some time (although very short) check the connection and start a new thread. back_log value indicates how many requests a short time before MySQL momentarily stops answering new requests may be the presence of the stack.
# If you expect to have many connections in a short period of time, you need to increase it. In other words, if the MySQL connection data reach max_connections, the new request will be the presence of the stack,
# wait for a connection to the release of resources, the number of the stack that is back_log, if the number of waiting for the connection of more than back_log, will not He was awarded the connection resources.
# In addition, this value (back_log) limited the size of your operating system for incoming TCP / IP connections listen queue.
# Your operating system has its own limitations (you can check your OS documentation to find out the maximum value of this variable), attempted to set back_log higher than your operating system limit will be ineffective in this queue size.

= 1000 max_connections
# the MySQL maximum number of connections, the connection request to the server if a concurrent greater amount, it is recommended to increase this value to increase the number of parallel connections, of course, can be established only when the machine is supported, because, if more connections, MySQL will provide connectivity between buffer for each connection, it will cost more memory, so to adjust the value, not blindly increase the set value. Can lead 'conn%' wildcard view the current state of the number of connections, to decide the size of the value.

6000 = max_connect_errors
# For the same host, if there is over-interrupt error connection number of the parameter value, the host connection will be disabled. For the hosts were lifted, execute: FLUSH HOST.

= 65535 open_files_limit
# open file descriptor limit the MySQL, the default minimum 1024; when open_files_limit is not configured, and max_connections * 5 Comparative ulimit -n value, which far-reaching which,
# open_file_limit is configured when compared open_files_limit and the value of max_connections * 5, which Dayong which.

= 128 table_open_cache
# MySQL open a table each, will be read into the cache some data to table_open_cache, when MySQL can not find the appropriate information in the cache, only to read the disk. The default value of 64
# is assumed that the system 200 concurrent connections need to set this parameter to 200 * N (N is the number of file descriptors required for each connection);
# table_open_cache when the set is large, if the processing system not so much a file descriptor, then there will be failure of the client, not connected

4M = max_allowed_packet
# acceptable packet size; increase the value of the variable is very safe, because only when needed will allocate additional memory. For example, only when you issue a long query or MySQLd must return a big result row MySQLd will allocate more memory.
# The variable whichever is less reason for default is a precautionary measure to capture error packets between clients and servers, and ensure that incidental use will not lead to large packet memory overflow.

1M = binlog_cache_size
# transaction, in the absence of submitted logs generated record to the Cache; wait until the transaction commits to be submitted, put the logs persisted to disk. The default size of 32K binlog_cache_size

= 8M max_heap_table_size
# defines the size of the memory table (memory table) user can create. This value is used to calculate the maximum row value memory table. This variable supports dynamic change

= 16M the tmp_table_size
# heap of the MySQL (deposited) Table buffer size. All the joint within a DML instruction is completed, and most of the joint can not even have a temporary table that is complete.
# Most temporary tables are memory-based (HEAP) tables. Having a temporary table in the hard disk (and the length of all the columns) is large record length or a BLOB table storing column.
# If an internal heap (accumulate) table size exceeds tmp_table_size, MySQL can automatically memory heap table instead of a hard disk-based MyISAM table as necessary. You can also increase the temporary table size by setting tmp_table_size options. That is, if the increase in value, MySQL will simultaneously increase the size of the heap table, you can achieve the effect of improving the query speed connection

2M = read_buffer_size
# MySQL read into the buffer size. Request table for assigning a sequential scans read into the buffer, MySQL allocates some memory buffer for it. read_buffer_size variable controls the size of the buffer.
# If the request for a sequential scan of the table are very frequent, and often you think scanning too slow, its performance can be improved by increasing the size of the variable value and the buffer memory

= 8M read_rnd_buffer_size
# MySQL random read buffer size. When reading a row in any order (e.g., sorted order), assigning a random read buffer. When ordering inquiries,
# MySQL will first scan it again this buffer to avoid disk seeks, speed up the search, if needed sorting large amounts of data, it should adjust the value. However, MySQL will release the buffer space for each client connection, it should be possible to set the appropriate value to avoid too much memory overhead

= 8M sort_buffer_size
# MySQL perform the sort buffer size used. If you want to increase ORDER BY speed, first see if you can get MySQL to use indexes rather than an extra sorting phase.
# If not, you can try to increase the size of the variable sort_buffer_size

= 8M join_buffer_size
# query combined buffer size can be used, and as sort_buffer_size, the corresponding allocation parameter memory is connected to each of the exclusive

8 = the thread_cache_size
# value (default 8) can be reused to save the number of threads in the cache, when the cache is disconnected if there is space, then the client thread is placed in the cache,
# if the thread is re request, the request read from the cache, if the cache is empty or a new request, then the thread will be re-created, if there are many new threads,
# increase this value can improve system performance by comparing Connections and variable Threads_created state, we can see the effect of this variable. (-> represents the value to be adjusted)
# of physical memory provided in accordance with the following rules:
#. 1G ->. 8
# 2G -> 16
# 3G -> 32
# greater than 3G -> 64

query_cache_size = 8M
query buffer size #MySQL (from 4.0.1, MySQL provides the query cache mechanism) use the query cache, MySQL SELECT statements and query results will be stored in the buffer,
# in the future for the same SELECT statement (case sensitive write), read results directly from the buffer. According to MySQL user manual, query buffer can be up to 238% efficiency.
# By checking the status value 'Qcache_%', you can know query_cache_size set is reasonable: If the value of Qcache_lowmem_prunes is very large, it indicates that the buffer is not often the case,
# if the value of Qcache_hits is very large, it indicates that the query cache very frequently used, at this point the need to increase the buffer size; if the value Qcache_hits little, it indicates that your query repetition rate is very low,
# in this case to use the query cache but will affect the efficiency, consider not query buffer. Furthermore, the addition SQL_NO_CACHE in the SELECT statement can be clearly said they did not use the query cache

= 2M query_cache_limit
# buffer size that can be used to specify a single query, the default 1M

= 4M key_buffer_size
# earmarked for the index buffer size, increase in the index it could be better addressed (for all read and multiple write), to as much as you can afford. If you make it too big,
# system will begin to change pages and really slowed down. For memory 4GB server about this parameter can be set to 384M or 512M. By checking the status value Key_read_requests and Key_reads,
# can know key_buffer_size set is reasonable. Ratio key_reads / key_read_requests should be as low as possible,
# is at least 1: 100, 1: 1000 Better (status values mentioned above may be used SHOW STATUS LIKE 'key_read%' is obtained). Note: This parameter value is set too high but will reduce overall server efficiency

4 = the ft_min_word_len
# vocabulary word minimum length, the default 4

transaction_isolation = REPEATABLE-the READ
# MySQL supports four transaction isolation levels, they are:
. # the READ-UNCOMMITTED, the READ-COMMITTED, REPEATABLE-the READ, SERIALIZABLE
# Absence, MySQL default uses REPEATABLE-READ, ORACLE default is a READ-COMMITTED

MySQL-bin = log_bin
binlog_format = Mixed
expire_logs_days = 30 # binlog deleted more than 30 days

log_error = /data/mysql/mysql-error.log # error log path
slow_query_log = 1
long_query_time = 1 # slow query time more than one second, compared with the slow query
slow_query_log_file = /data/mysql/mysql-slow.log

performance_schema = 0
explicit_defaults_for_timestamp

#lower_case_table_names = 1 # case insensitive

skip-external-locking #MySQL option to avoid external locking. This option is enabled by default

default-storage-engine = InnoDB # default storage engine

1 = the innodb_file_per_table
# tablespace the InnoDB independent mode, each table for each database to generate a data space
# separate tablespaces advantages:
# 1. Each table has its own separate table space.
# 2. Each table and index data will exist in their own tablespaces.
# 3. It may be implemented in a single table moving different databases.
# 4. Space can be recovered (in addition to the drop table operation, not their own table space recovery)
# disadvantages:
# single table is excessively increased, if more than 100G
# CONCLUSION:
# shared tablespace little advantage in Insert operation. The other did not perform well a separate table space. When you enable a separate table space, a reasonable adjustment: innodb_open_files

= 500 innodb_open_files
# restrictions Innodb can open tables of data, particularly if the case library table, please add this. The default value is 300

= 64M innodb_buffer_pool_size
# the InnoDB using a buffer pool and to store the original index data, unlike MyISAM.
# larger you set here, you are accessing the table in which the data required for disk I / fewer O.
# in a standalone on the database server, you can set this variable to the server's physical memory size of 80%
# Do not set too large, otherwise, due to the competition of the physical memory may cause the operating system paging bumps.
# Note that you each on 32-bit systems the process may be limited 2-3.5G user level memory limitations,
too # so do not set.

= 4 innodb_write_io_threads
innodb_read_io_threads = 4
# I InnoDB read-write processing on the data page background thread / O (input and output) requests to change the number of CPU core according to your default is 4
# Note: these two parameters do not support dynamic change , need to be added to the parameters in my.cnf, restart the MySQL service after modification, allowed values range from 1-64

0 = innodb_thread_concurrency
# The default setting is 0, meaning no limit on the number of concurrent recommended here is set to 0, to play better multi-core CPU processing power, increase the amount of concurrency

=. 1 innodb_purge_threads
# clear operation in the InnoDB type of operation is a periodic recovery unnecessary data. In several previous versions, clear operation is part of the main thread, it may block other database operations this means running.
# MySQL5.5.X version from the start, the operation runs on a separate thread, and support more concurrent. Users may select whether to use a single removal operation by setting the configuration parameters innodb_purge_threads
# single thread, the default parameter settings for the case where 0 (no separate threads), which represents a separate set clear threads is 1. 1 recommendations

= 2 innodb_flush_log_at_trx_commit
# 0:. If the brush will be written innodb_flush_log_at_trx_commit a value of 0, log buffer to disk log files per second, when the transaction is committed without any operation (execution is performed by the master thread of the thread mysql
# Main . per second thread will redo log buffer is written to disk redo log files (rEDO lOG) regardless of whether the transaction has been submitted) default log file is ib_logfile0, ib_logfile1
# 1: when set to the default value to 1, every time you commit a transaction, the log buffer will be flushed to the log.
# 2: If set to 2, each transaction will be submitted to write the log, but does not perform the operation brush. Second timer will brush the log file. Note that, it does not guarantee 100% per second will surely brush to disk, depending on the scheduling process.
# Every transaction commit data written to the transaction log is written here is only invoked writes to the file system and the file system is cached, so this does not guarantee that the write data has been written to physical disk
# 1 is the default value in order to ensure full ACID. Of course, you can configure this item to a value other than 1 in exchange for higher performance, but when the system crashes, you will lose 1 second of data.
# Set to 0, then, mysqld process crashes and they will lose the last second of transactions. Set 2, will only lose the last 1 second of data when an operating system crash or power failure. InnoDB doing recovery time will ignore this value.
# Summary
# 1 is set to be the safest course, but the performance page is the worst (relative to other two parameters, but not unacceptable). If you do not ask for data consistency and integrity, it can be set to 2, if only the most performance requirements, such as high concurrent write log server, set to 0 to obtain higher performance

2M = the innodb_log_buffer_size
# This parameter determines these log files used by memory size, in units of M. A larger buffer can improve performance, but an unexpected fault data will be lost. MySQL developers recommend setting between 1-8M

= 32M innodb_log_file_size
# determine this parameter data log file size, larger setting can improve performance, but also increases the time required to recover a failed database

=. 3 innodb_log_files_in_group
# To improve performance, MySQL a circular manner can be written to the log file multiple files. The recommended setting is 3

= 90 innodb_max_dirty_pages_pct
# InnoDB main thread pool data cache to refresh the dirty data ratio is less than 90%

= 120 innodb_lock_wait_timeout 
# is rolled back before the InnoDB transaction may wait for a lock timeout in seconds. InnoDB automatically detects transaction deadlocks in its own lock table and rolls back the transaction. InnoDB with LOCK TABLES statement noted that the lock settings. The default is 50 seconds

= 8M bulk_insert_buffer_size
# bulk insert cache size, this parameter is for the MyISAM storage engines. Adapted to the disposable insert records + 100-1000, to improve efficiency. The default is 8M. Can for the size of the data volume, double the increase.

= 8M the myisam_sort_buffer_size
# MyISAM sized buffer used for recovery of the table, when the allocated sorting MyISAM index REPAIR TABLE or ALTER TABLE create indexes with CREATE INDEX process or buffer

= 10G myisam_max_sort_file_size
# If the temporary file can become more than the index, do not use the fast sort index method to create an index. Note: This parameter is given in bytes

= 1 myisam_repair_threads
# If the value is greater than 1, MyISAM table indexes are created in parallel in the Repair by sorting process (each index in its own thread) 

= 28800 interactive_timeout
# number of seconds to wait for the server to shut down the activities of the interactive connection before. Interactive client is defined as the use CLIENT_INTERACTIVE option () in mysql_real_connect client. Default: 28800 seconds (8 hours)

28800 = wait_timeout
# number of seconds to wait before the server shuts down activity of non-interactive connection. When the thread starts, according to the global value wait_timeout interactive_timeout or global session initialization value wait_timeout value
# depending on the type of client (connection option CLIENT_INTERACTIVE mysql_real_connect defined by () in). Parameters Default: 28800 seconds (8 hours)
# maximum number of connections supported by the MySQL server is capped, because after each connection is established will consume memory, so we want the client to connect to MySQL Server processed the appropriate action ,
# should disconnect and release the memory occupied. If your MySQL Server has a large number of idle connections, they will not only consume memory in vain, and if the connection has been accumulated without disconnecting,
# will eventually reach the maximum number of connections MySQL Server, which will be reported 'too many connections' error . For wait_timeout value is set should be determined according to the operation of the system.
# After the system running for some time, you can view the show processlist command by the current connection status of the system, if there are a large number of process connections sleep state, then this parameter is set too high, the
# appropriate adjustments can be made smaller. To set both interactive_timeout and wait_timeout take effect.

[the mysqldump]
Quick
the max_allowed_packet = # 16M and the server sends the maximum acceptable packet length

[myisamchk]
key_buffer_size = 8M
sort_buffer_size = 8M
read_buffer = 4M
write_buffer = 4M

Guess you like

Origin www.cnblogs.com/manhelp/p/11278757.html
5.5