Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the properties of the MySQL database INI file

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the attributes of MySQL database INI file, which is very detailed and has certain reference value. Friends who are interested must finish reading it.

(1) back_log:

The number of connections required for MySQL. This works when the main MySQL thread gets a lot of connection requests in a very short period of time, and then the main thread takes some (albeit short) time to check the connection and start a new thread.

The back_ log value indicates how many requests can be stored on the stack in a short period of time before MySQL temporarily stops answering new requests. Only if you expect to have many connections in a short period of time, you need to increase it, in other words, this value is the size of the listening queue for incoming TCP/IP connections. Your operating system has its own limits on the queue size. Trying to set the limit that back_log is higher than your operating system will not be valid.

When you look at your list of host processes and find a large number of 264084 | unauthenticateduser | xxx.xxx.xxx.xxx | Connect | NULL | login | NULL processes to be connected, you need to increase the value of back_log. The default value is 50, and I'll change it to 500.

(2) interactive_timeout:

The number of seconds the server waits for action on an interactive connection before closing it. An interactive customer is defined as a customer who uses the CLIENT_INTERACTIVE option for mysql_real_connect (). The default value is 28800, and I'll change it to 7200.

(3) key_buffer_size:

The index block is buffered and shared by all threads. Key_buffer_size is the buffer size for index blocks, increasing it to get better-handled indexes (for all reads and multiple overrides) as much as you can afford. If you make it too big, the system will start to change pages and really slow down. The default is 8388600 (8m), and my MySQL host has 2GB memory, so I changed it to 402649088 (400MB).

(4) max_connections:

The number of simultaneous customers allowed. Increasing this value increases the number of file descriptors required by mysqld. This number should be increased, otherwise you will often see Toomanyconnections errors. The default value is 100, and I'll change it to 1024.

The MySQL database INI file has several properties

(5) record_buffer:

Each thread that performs a sequential scan allocates a buffer of this size to each table it scans. If you do a lot of sequential scans, you may want to increase this value. The default value is 131072 (128K), which I changed to 16773120 (16m)

(6) sort_buffer:

Each thread that needs to sort allocates a buffer of that size. Increase this value to speed up ORDERBY or GROUPBY operations. The default value is 2097144 (2m), which I changed to 16777208 (16m).

(7) table_cache:

The number of open tables for all threads. Increasing this value increases the number of file descriptors required by mysqld. MySQL requires 2 file descriptors for each unique open table. The default value is 64, and I'll change it to 512. (, thread_cache_size:

The number of threads saved in that can be reused. If so, the new thread is fetched from the cache, and the customer's line is placed in the cache if there is space when the connection is disconnected. If there are many new threads, the value of this variable can be used to improve performance. By comparing the variables of the Connections and Threads_created states, you can see the role of this variable. I set it to 80.

(8) wait_timeout:

The number of seconds the server waits for action on a connection before shutting it down. The default value is 28800, and I'll change it to 7200. Note: parameters can be adjusted by modifying the / etc/my.cnf file and restarting MySQL. This is a more cautious work, and the above results are just some of my views, which you can further modify according to the hardware of your own host (especially the memory size).

These are all the contents of this article entitled "what are the properties of MySQL database INI files?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 202

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report