Configuration of MySQL

Source: Internet
Author: User

MySQL configuration file

/etc/my.cnf

Editing a configuration file

[Email protected] ~]# VIM/ETC/MY.CNF

# The MySQL server

[Mysqld]

Port = 3306

Socket =/tmp/mysql.sock

Skip-locking

Key_buffer_size = 256M

Max_allowed_packet = 1M

Table_open_cache = 256

Sort_buffer_size = 1M

Read_buffer_size = 1M

Read_rnd_buffer_size = 4M

Myisam_sort_buffer_size = 64M

Thread_cache_size = 8

Query_cache_size= 16M

# Try number of CPU ' s*2 for thread_concurrency

Thread_concurrency = 8

The above configured display can be viewed in the previous section on "MySQL tuning " for understanding.

Let's add two lines of configuration to the original base.

Interactive_timeout = 8

Wait_timeout = 8

The second line configuration is dependent on the first row, there is no first line configuration, and the second row configuration is not valid, and the two configurations are used together.

The client sent over to query MySQL may have some sleep state, when it is processed after the link will not immediately disconnect, temporarily maintain the connection, but MySQL has a connection number limit, more than is not connected, so we have completed the connection number of connections to let it itself disconnected, this is Wait_ The role of timeout.

Another configuration is about "slow query"

MySQL will have some slow queries, such as which SQL execution is slow, how long to execute, we can go to record,

Open the log of the slow query (the above configuration is written down), two parameters of the first

Long_query_time = 1

Log_slow_queries =/data/mysql/slow.log

As long as it's more than a second, we go to record this "slow query", this configuration is very useful, when doing tuning this is an important reference, such as: Which SQL statement execution is slow, we will be based on this "slow query" log to judge.


Configuration of MySQL

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.