Mysql configuration file my.cnf Chinese version of the control _mysql

Source: Internet
Author: User
Tags mysql client reserved
#BEGIN CONFIG INFO
#DESCR: 4GB RAM, using only InnoDB, ACID, a small number of connections, large queue load
#TYPE: SYSTEM
#END CONFIG INFO

#
# This MySQL profile example for 4G memory
# Main Use InnoDB
#处理复杂队列并且连接数量较少的mysql服务器
#
# Copy this file to/ETC/MY.CNF as a global setting,
# MYSQL-DATA-DIR/MY.CNF Specify settings as Server
# (@localstatedir @ for this installation) or put
# ~/.my.cnf as user settings.
#
# 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
# Please run the program with the "--help" parameter after the program.
#
# More details about the standalone option can be found in the manual
#

#
# The following options will be read by the MySQL client application.
# Note Only the client application included with MySQL guarantees that this content can be read.
# If you want your own MySQL application to get these values
# You need to specify these options when the MySQL client library is initialized

#
[Client]
#password = [Your_password]
Port = @MYSQL_TCP_PORT @
Socket = @MYSQL_UNIX_ADDR @

# * * * Apply Customization options * * *

#
# MySQL Service Side
#
[Mysqld]

# General configuration Options
Port = @MYSQL_TCP_PORT @
Socket = @MYSQL_UNIX_ADDR @

# Back_log is the number of connections the operating system can hold in the listening queue.
# The queue holds the connection before the MySQL Connection Manager thread is processed.
# If you have a very high connection rate and ' connection refused ' error,
# You should add the value here.
# Check your operating system documentation to get the maximum value for this variable.
# If you set the Back_log to a higher value than your operating system, there will be no effect.
Back_log = 50

# Do not listen on TCP/IP ports.
# If all the processes are connected to the local mysqld on the same server,
# This setting will be the way to enhance security
# All MYSQLD connections are made through UNIX sockets or named pipes.
# Note that if you do not open the Named pipe option on Windows, you only use this item
# (through the "enable-named-pipe" option) will cause the MySQL service to have no effect!
#skip-networking

# The maximum number of simultaneous sessions allowed by the MySQL service
# One of the connections will be reserved by super privileges as an administrator.
# even if the number of connections has reached the upper limit.
max_connections = 100

# The maximum number of error allowed per client connection, if this limit is reached.
# This client will be blocked by the MySQL service until the "FLUSH HOSTS" or service reboot is performed.
# an illegal password and other errors at the time of the link increase this value.
# View the "aborted_connects" status to get the global counter.
Max_connect_errors = 10

# Number of tables opened by all threads.
# Increasing this value increases the number of file descriptors required for mysqld
# so you need to make sure that the "open-files-limit" variable set in [Mysqld_safe] has a minimum number of open files allowed at least 4096
Table_cache = 2048

# Allow external file-level locks. Opening a file lock can adversely affect performance
# so use this option only if you are running multiple database instances on the same file (note that there are still other constraints!)
# or you use some other software dependencies on the file level to lock the MyISAM table
#external-locking

# The maximum size of the request package that the service can handle and the maximum request size that the service can handle (is necessary when working with large BLOB fields)
# The size of each connection is independent. Dynamic Increase in size
Max_allowed_packet = 16M

# Binlog in a transaction to record the cache size held by the SQL state
# If you often use large, multiple-declaration transactions, you can increase this value to achieve greater performance.
# All engaged states will be buffered in Binlog buffers and then written to Binlog once committed
# If the transaction is larger than this value, a temporary file on disk will be used instead.
# This buffer is created when each connected transaction is first updated state
Binlog_cache_size = 1M

# The maximum allowable capacity of a separate memory table.
# This option to prevent accidental creation of an oversized memory table causes all memory resources to be exhausted.
Max_heap_table_size = 64M

# The sort buffer is used to handle the sort that is caused by the order by and the group by queue
# If the sorted data cannot be placed in the sort buffer,
# A disk-based merge classification that is used for substitution
# View the ' sort_merge_passes ' state variable.
# is assigned by each thread when the sort occurs
Sort_buffer_size = 8M

# This buffer is used to optimize the Union (full joins union without indexes).
# Similar unions have very poor performance in most cases,
# but setting this value large can mitigate the performance impact.
# View the number of total unions through the ' Select_full_join ' state variable
# When a full union occurs, it is allocated in each thread
Join_buffer_size = 8M

# How many threads we keep in the cache for reuse
# When a client disconnects, if the thread in the cache is less than thread_cache_size,
# The client thread is placed in the cache.
# This can greatly reduce the overhead of thread creation when you need a lot of new connections
# (in general, if you have a good threading model, there's no noticeable performance boost.)
Thread_cache_size = 8

# This allows the application to give the thread system a hint at the same time given the number of threads that are eager to be run.
# This value is only meaningful for systems that support the thread_concurrency () function (for example, Sun Solaris).
# you can try using [CPU number]* (2..4) as thread_concurrency value
Thread_concurrency = 8

# query buffering is often used to buffer the results of a SELECT and to no longer perform direct return results the next time the same query is made.
# Open query buffering can greatly improve server speed, if you have a large number of the same query and rarely modify the table.
# Check the "qcache_lowmem_prunes" state variable to see if the current value is high enough for your load.
# Note: When your table changes frequently or if your query text is different each time,
# query buffering may cause performance degradation rather than performance improvement.
Query_cache_size = 64M

# Only a result that is less than this setting will be buffered
# This setting protects the query buffer and prevents a large result set from overwriting all other query results.
Query_cache_limit = 2M

# The smallest word length that is indexed by Full-text retrieval.
# You may want to reduce it if you need to search for shorter words.
# Note that after you modify this value,
# You need to rebuild your fulltext index
Ft_min_word_len = 4

# If your system supports the Memlock () function, you may want to turn on this option to allow the running MySQL to lock in memory and prevent possible swapping out of memory when it is highly stressful.
# This option is good for performance
#memlock

# The table type used as the default when creating new tables.
# This value will be used when creating representations that do not specifically perform table types
Default_table_type = MYISAM

# The heap size used by the thread. Memory for this capacity is reserved for each connection.
# MySQL itself often does not require more than 64K of memory
# If you use your own UDF function that requires a lot of heaps
# or your operating system needs more heaps for some operations,
# You might want to set it up a little bit higher.
Thread_stack = 192K

# Set the default transaction isolation level. The available levels are as follows:
# read-uncommitted, read-committed, Repeatable-read, SERIALIZABLE
Transaction_isolation = Repeatable-read

# The maximum size of an internal (in-memory) temporary table
# If a table grows larger than this, it will automatically be converted to a disk-based table.
# This limit is for a single table, not a sum.
Tmp_table_size = 64M

# turn on the binary log feature.
# In a replication (replication) configuration, you must open this key as the Master master server
# If you need to do a point-in-time restore from your last backup, you also need binary logging.
Log-bin=mysql-bin

# If you're using a chained copy mode from the server structure (A->B->C),
# You need to open this item on Server B.
# This option opens a log of updates that have been redo from the thread.
# and writes it to the binary log from the server.
#log_slave_updates

# Open full query log. All queries received by the server (even for a query with an incorrect syntax)
# will be recorded. This is useful for debugging, which is often turned off in a production environment.
#log

# Prints warnings to the error log file. If you have any questions about MySQL,
# You should turn on the warning log and examine the error log carefully to find out the probable cause.
#log_warnings

# Record slow queries. A slow query refers to a query that consumes more time than the "long_query_time" definition.
# If Log_long_format is opened, queries that do not use the index are also logged.
# If you often add new queries to existing systems. This is generally a good idea,
Log_slow_queries

# All the queries that use more than this time (in seconds) are considered slow queries.
# do not use "1" here, otherwise it will cause all queries, even very fast query pages to be recorded (since MySQL's current time accuracy can only reach the second level).
Long_query_time = 2

# More information is logged in the slow log.
# generally this item is best opened.
# Open this record so that queries that do not use the index are also attached to the slow log as a slow-speed query.
Log_long_format

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.