mysql my.cnf parameters under Centos

# client parameters

[client]

#Set the default character set format

default_character_set=utf8

 

[mysql]

default_character_set=utf8

 

#server parameters

[mysqld]

#Set the default character set format

character_set_server=utf8                                                

bind_address=127.0.0.1                            

port=3306    

                                  

basedir=/usr/local/XXX/XX/db/                         

datadir=/usr/local/XXX/XX/db/data/                         

user=mysql                                     

log_error=/var/log/XXX/XX/mysql-error.log        

# Log slow queries. Slow queries are those that consume more time than defined by "long_query_time".
# If log_long_format is on, queries that don't use indexes are also logged.
# If you frequently add new queries to In an existing system. Generally this is a good idea, log_slow_queries

# All queries that use more than this time (in seconds) will be considered slow queries.

# Don't use "1" here, otherwise it will cause all queries, even very fast query pages to be logged (due to MySQL's current time precision

#degrees can only reach the level of seconds).     

long_query_time=2                               

slow_query_log_file=/var/log/XXX/XX/mysql-slow.log  

default_storage_engine=InnoDB  

#The number of files each process can open, make sure the system limit is set higher than this value

open_files_limit=65535

 

# back_log is the number of connections the OS can keep in the listening queue,
# the queue holds connections before the MySQL connection manager thread processes them.
# If you have a very high connection rate and get a "connection refused" error,
# you The value here should be increased.
# Check your OS documentation for the maximum value of this variable.
# Setting back_log to a value higher than your OS limit will have no effect

back_log=600

 

# The upper limit of the number of simultaneous sessions allowed by the MySQL service
# One of the connections will be reserved by the SUPER privilege to log in as an administrator.
# Even if the upper limit of the number of connections has been reached.

#If show variables like '%max_connections%' query value is less than the set value

#Add LimitNOFILE=10000   LimitNPROC=10000 at the end of /usr/lib/systemd/system/mysql.server

max_connections=500

# The maximum size of request packets that the service can handle and the maximum request size that the service can handle (when working with large BLOB fields

# when necessary)
# Independent size for each connection. Size increases dynamically

max_allowed_packet=32M

 

# The maximum size of request packets that the service can handle and the maximum request size that the service can handle (when working with large BLOB fields

# when necessary)
# Independent size for each connection. Size increases dynamically

sort_buffer_size=256K

# This buffer is used to optimize full joins (full JOINs without indexes).
# Similar joins have very bad performance in most cases,
# but setting this value to a large value can mitigate the performance impact.
# Pass The "Select_full_join" state variable looks at the number of full joins
# allocated in each thread when a full join occurs

join_buffer_size=256K

# How many threads do we keep in the cache for reuse
# When a client disconnects, if the number of threads in the cache is less than thread_cache_size,
# the client threads are put in the cache.
# This can be done if you need a lot of new threads Greatly reduces the overhead of thread creation when connecting.
(In general if you have a good threading model, this will not have a significant performance improvement.)

thread_cache_size=64

 

# MyISAM uses a special tree-like cache to make burst inserts
# (these inserts are, INSERT … SELECT, INSERT … VALUES (…), (…), …, and LOAD DATA
# INFILE) faster. This variable limits each The number of bytes of the buffer tree in each process.
# Set to 0 to turn off this optimization.
# Do not set this value larger than "key_buffer_size" for optimization. #
This buffer will be allocated when a burst insert is detected.

bulk_insert_buffer_size=8M

# Buffer size for full table scan of MyISAM table.
# Allocate in corresponding thread when full table scan is needed.

read_buffer_size=256K

# 当在排序之后,从一个已经排序好的序列中读取行时,行数据将从这个缓冲中读取来防止磁盘寻道.
# 如果你增高此值,可以提高很多ORDER BY的性能.
# 当需要时由每个线程分配

read_rnd_buffer_size=256K

# 此允许应用程序给予线程系统一个提示在同一时间给予渴望被运行的线程的数量.
# 此值只对于支持 thread_concurrency() 函数的系统有意义( 例如Sun Solaris).
# 你可可以尝试使用 [CPU数量]*(2..4) 来作为thread_concurrency的值

thread_concurrency=8

query_cache_size=8M

query_cache_limit=512K

query_cache_min_res_unit=2k

thread_stack=128K

transaction_isolation=READ-COMMITTED

tmp_table_size=256M

max_heap_table_size=32M

long_query_time=2

key_buffer_size=8M

lower_case_table_names=1

innodb_buffer_pool_size=128M

innodb_thread_concurrency=4

innodb_flush_log_at_trx_commit=2

innodb_log_buffer_size=16M

innodb_log_file_size=128M

innodb_log_files_in_group=3

innodb_lock_wait_timeout=120

innodb_file_per_table=1

skip-name-resolve

 

[mysqldump]                                     

quick                                           

max_allowed_packet=32M

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326008420&siteId=291194637