MySQL configuration file my. cnf Chinese version. For more information about the importance of each parameter, see mysql users.
# BEGIN CONFIG INFO
# DESCR: 4 gb ram, only InnoDB, ACID, a small number of connections, large queue Load
# TYPE: SYSTEM
# END CONFIG INFO
#
# This mysql configuration file example is for 4 GB memory
# Mainly use INNODB
# Mysql servers that process complex queues and have a small number of connections
#
# Copy the file to/etc/my. cnf as a global setting,
# Mysql-data-dir/my. cnf as the server to specify settings
# (@ Localstatedir @ for this installation) or put
#~ /. My. cnf is set as the user.
#
# In this configuration file, you can use the Long Options supported by all programs.
# If you want to know all the options supported by the program
# Add the "-- help" parameter after the program to run the program.
#
# More details about the independent options can be found in the Manual
#
#
# The following options will be read by the MySQL client application.
# Note that only client applications attached to MySQL can read this section.
# If you want your MySQL application to obtain these values
# You need to specify these options when initializing the MySQL client library
#
[Client]
# Password = [your_password]
Port = @ MYSQL_TCP_PORT @
Socket = @ MYSQL_UNIX_ADDR @
# *** Application customization options ***
#
# MySQL Server
#
[Mysqld]
# General configuration options
Port = @ MYSQL_TCP_PORT @
Socket = @ MYSQL_UNIX_ADDR @
# Back_log is the number of connections that the operating system can maintain in the listening queue,
# The queue stores the connection before the MySQL Connection Manager thread processes it.
# If you have a very high connection rate and an "connection refused" error occurs,
# You should add the value here.
# Check your operating system documentation to obtain the maximum value of this variable.
# If you set back_log to a value higher than your operating system limit, it will be ineffective
Back_log = 50
# Do not listen on the TCP/IP Port.
# If all processes are connected to the local mysqld on the same server,
# This setting will enhance security.
# All mysqld connections are performed through Unix sockets or named pipes.
# Note: In windows, if you do not enable the named pipe option, you only use this option.
# (Using the "enable-named-pipe" option) will cause the mysql service to have no effect!
# Skip-networking
# Maximum number of concurrent sessions allowed by the MySQL Service
# One of the connections will be retained as Administrator Logon by the SUPER permission.
# Even if the maximum number of connections has been reached.
Max_connections = 100
# Maximum number of errors allowed for each client connection. If this limit is reached.
# This client will be blocked by the MySQL service until "flush hosts" is executed or the service is restarted.
# This value is added for invalid passwords and other Link errors.
# View the status of "Aborted_connects" to obtain the Global Counter.
Max_connect_errors = 10
# Number of tables opened by all threads.
# Adding this value increases the number of file descriptors required by mysqld.
# In this case, you need to confirm that the "open-files-limit" variable in [mysqld_safe] allows at least 4096 files to be opened.
Table_cache = 2048
# Allow external file-level locks. Opening a file lock will negatively affect the performance.
# This option is used only when you run multiple database instances on the same file (note that there are still other constraints !)
# Alternatively, you can use other software dependencies on the file layer to lock the MyISAM table.
# External-locking
# The maximum size of the request packet that the service can process and the maximum size of the request that the service can process (required when working with a large BLOB field)
# Independent size of each connection. The size increases dynamically
Max_allowed_packet = 16 M
# In a transaction, binlog records the cache size of the SQL state.
# If you often use large, multi-statement transactions, you can add this value to obtain greater performance.
# All the statuses from the transaction will be buffered in the binlog buffer and then written to the binlog at one time after submission
# If the transaction is larger than this value, it will be replaced by a temporary file on the disk.
# This buffer is created when the transaction status of each connection is updated for the first time.
Binlog_cache_size = 1 M
# Maximum capacity allowed by an independent memory table.
# This option is used to prevent accidental creation of an oversized memory table from permanently consuming all memory resources.
Max_heap_table_size = 64 M
# Sort buffering is used to process sorting caused by order by and group by queues.
# If the sorted data cannot be placed in the SORT buffer,
# A disk-based consolidated category used as an alternative will be used
# View "Sort_merge_passes" status variables.
# Allocated by each thread when sorting occurs
Sort_buffer_size = 8 M
# This buffer is used to optimize full Union (full JOINs without indexes ).
# Similar joins have very bad performance in most cases,
# However, setting this value to a large value can reduce the performance impact.
# Use the "Select_full_join" status variable to view the total number of conjoins
# When full Union occurs, it is allocated in each thread
Join_buffer_size = 8 M
# How many threads are reserved in the cache for Reuse
# When a client is disconnected, if the cache thread is smaller than thread_cache_size,
# The client thread is put into the cache.
# This can greatly reduce the thread creation overhead when you need a large number of new connections
# (Generally, if you have a good thread model, this will not significantly improve the performance .)
Thread_cache_size = 8
# This allows the application to give the thread system a prompt to give the desired number of threads at the same time.
# This value is only valid for systems that support the thread_concurrency () function (for example, Sun Solaris ).
# You can try to use [number of CPUs] * (2 .. 4) as the value of thread_concurrency
Thread_concurrency = 8
# Query buffering is often used to buffer SELECT results and no direct return results will be executed in the next same query.
# Enabling the Query Buffer can greatly improve the server speed. If you have a large number of identical queries and rarely modify tables.
# Check the "Qcache_lowmem_prunes" status variable to check whether the current value is high enough for your load.
# Note: When your table changes frequently or if your original query is different each time,
# Query buffering may cause performance degradation rather than performance improvement.
Query_cache_size = 64 M
# The result is buffered only when it is smaller than this value.
# This setting is used to protect the Query Buffer and prevent a large result set from overwriting all other query results.
Query_cache_limit = 2 M
# The minimum length of the index to be searched in full text.
# You may want to reduce it if you need to search for shorter words.
# Note that after you modify this value,
# You need to recreate your FULLTEXT Index
Ft_min_word_len = 4
# If your system supports the memlock () function, you may want to enable this option to make the running mysql in high memory tension, keep the data locked in the memory and prevent it from being swapping out.
# This option is useful for performance
# Memlock
# When creating a new table, it is used as the default table type,
# This value is used if the table type is not specially executed during creation.
Default_table_type = MYISAM
# The heap size used by the thread. This capacity is reserved for each connection.
# MySQL itself usually does not require 64 KB of memory
# If you use your own UDF that requires a large number of heap Functions
# Or your operating system needs more heaps for some operations,
# You may need to set it to a higher level.
Thread_stack = 192 K
# Set the default transaction isolation level. The available level is as follows:
# READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ, SERIALIZABLE
Transaction_isolation = REPEATABLE-READ
# Maximum size of temporary internal (in memory) tables
# If a table grows to a value greater than this value, it is automatically converted to a disk-based table.
# This restriction applies to a single table, not the sum.
Tmp_table_size = 64 M
# Enable the binary log function.
# In the replication configuration, this option must be enabled as the MASTER server
# If you need to recover from your last backup based on time points, you also need binary logs.
Log-bin = mysql-bin
# If you are using the chained slave server structure copy mode (A-> B-> C ),
# You need to enable this option on server B.
# This option is used to open the log that has been re-updated on the slave thread,
# And write it into the binary log of the slave server.
# Log_slave_updates
# Open the full query log. All queries received by the server (or even queries with an incorrect syntax)
# Will be recorded. This is very useful for debugging and is often disabled in the production environment.
# Log
# Print the warning to the error log file. If you have any problems with MySQL
# Open the warning log and carefully review the error log to find out the possible causes.
# Log_warnings
# Record slow query. Slow query refers to a query that consumes more time than "long_query_time.
# If log_long_format is enabled, queries without indexes will also be recorded.
# If you often add new queries to existing systems, this is generally a good idea,
Log_slow_queries
# All queries that use more time (in seconds) are considered as slow queries.
# Do not use "1" here; otherwise, all queries may be recorded, or even very fast query pages (because the current MySQL time precision can only reach the second level ).
Long_query_time = 2
# Record more information in slow logs.
# It is recommended to enable this option.
# Enabling this option will record the queries that do not use indexes as slow queries and append them to slow logs.
Log_long_format