Summary of MySQL System Configuration Parameter Optimization [in continuous update]

Source: Internet
Author: User

During my project, I have made some adjustments and Optimizations to MySQL system configuration parameters, such as connection timeout disconnection, SQL exceeding the buffer length limit, and memory table size adjustment, here we will sort out the summary one by one so that similar problems can be quickly solved in the future.

1. How can I solve the problem of MySQL connection timeout disconnection?

Solution:
Add or modify the following two variables in the [mysqld] section of the my. CNF file:

 
Wait_timeout =28800Interactive_timeout=28800

The default value is 8 hours (8*3600 = 28800 seconds), which can be changed to 24 hours or 30 days as needed.

2. How can I solve the problem of executing an SQL statement exceeding the maximum length of the buffer?

If the SQL statement is too large or the statement contains blob or longblob fields, the preceding problem may occur. For example, processing image data.
Solution:
Add or modify the following variables in the my. CNF file:

 
Max_allowed_packet = 10 m (set to the desired size)

The max_allowed_packet parameter is used to control the maximum length of its communication buffer.

3. How to modify the memory table size of MySQL?

1) Add the parameter-O max_heap_table_size = 32 m when starting MySql in the startup Option
2) modify my. CNF and add max_heap_table_size = 32 m to the [mysqld] segment.
3) modify it in the mysql client tool:

 mysql> set max_heap_table_size =  32777216  ; query OK,   0  rows affected ( 0.00   Sec) mysql  show variables like  '  % heap %   ' ;  + ------------------- + ---------- + | variable_name | value | + --------------------- + ---------- + | max_heap_table_size |  32777216  | + ------------------- + ---------- +  1  row  in  set ( 0.00  Sec) 
Related Article

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.