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

How to set the main parameters of mysql

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to set the main parameters of mysql, the contents of the article are carefully selected and edited by the author, with a certain pertinence, the reference significance for you is still relatively great, the following with the author to understand how to set the main parameters of mysql.

The setting of main parameters of mysql

(1) innodb_buffer_pool_size

In order to improve write performance, the data to be written can be merged in the buffer (buffer) and then sent to the next level of storage.

Innodb_buffer_pool is the memory buffer that InoDB uses to cache its data and indexes, and innodb_buffer_pool_size sets its size. In theory, the higher you set this value, the less disk Imando O is required to access the data. A common practice is to make this value larger than the hotspot data, so that you can achieve better performance. If you are not clear about the amount of data and access mode of the environment, it is recommended that you set it to 70% or 80% of the machine's physical memory.

(2) innodb_log_file_size

The size of each log file in the log line. It is recommended that you set the size of the log file to 256MB or larger to meet the general needs.

(3) innodb_flush_log-at_trx_commit, it is recommended to set it to 2

The default value for this option is 1, and when set to 2, the log buffer is written to the file when each transaction is committed, but the log file is not flushed to disk. Refresh of log files occurs only once per second. So, in theory, an operating system crash or power outage will only lose the last second of the transaction.

(4) sync_binlog, it is recommended to set it to 0

If it is autocommit mode, each statement executed will be written to the second system log, otherwise each transaction will be written once. If the value of sync_binlog is positive, then every time the statement or the number of transactions set by the sync_binlog parameter is written to the binary log, the mysql CVM will synchronize its binary log to the hard disk. The default value is 0 and is not synchronized with the hard drive. A value of 1 is the safest option, but it is also the slowest and expensive.

After reading the above about how to set the main parameters of mysql, many readers must have some understanding. If you need to get more industry knowledge and information, you can continue to follow our industry information column.

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: 0

*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