MySQL variable modification and effective

Source: Internet
Author: User

People who have used MySQL know that our MySQL set variable is in the my.cnf file, usually modify the variable once after the MySQL service, but in the actual production server This is not allowed, we can use this statement to query all the MySQL variables

Mysql> show global variables;

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/86/8D/wKiom1fDzN_BrRKqAAExUMuDkpU932.png-wh_500x0-wm_3 -wmp_4-s_2972438836.png "title=" show Global Variables.png "alt=" Wkiom1fdzn_brrkqaaexumudkpu932.png-wh_50 "/>

If slow query log analysis is turned on in MySQL, check the default time for slow query and adjust the default time

mysql> show global variables like  "%_time"; + ------------------------+----------+| variable_name           | value    |+------------------------+----------+| flush_time              | 0         | | innodb_old_blocks_time | 0         | | long_query_time        | 1.000000 | |  slow_launch_time       | 2         | +------------------------+----------+4 rows in set  (0.00 sec) MySQL > set global long_query_time=2; query ok, 0 rows affected  (0.00 sec) 

In this session the variable will not take effect after the need to exit after the entry to view the MySQL variable to take effect, modified to remember to modify the my.cnf file so that MySQL after restarting the value of the variable is not changed, it is important to note that the use of set Global setting the value of the MySQL variable needs to be in the configuration of the [mysqld] stack in the my.cnf file to write down this variable, or MySQL will be restarted

This article from the "Technical essay" blog, reproduced please contact the author!

MySQL variable modification and effective

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.