MySQL service-MySQL variable type and variable settings

Source: Internet
Author: User

One, MySQL variable type:

MySQL uses variables to define the current server's characteristics, save state information, and so on. We can configure MySQL by manually changing the value of the variable, or we can get the current state information of MySQL through a variable. The variable type of MySQL can be divided from the way variables are modified and the scope of the variables to be effective.

1. Depending on how the variable is modified:

Dynamic variables: You can adjust the meaning of the MySQL runtime and take effect immediately;

Static variables: Need to be modified in the configuration file, restart the service after the effective;

2. Depending on the scope of the variable to take effect:

Global variables: Service level settings, for the entire service to take effect;

Session variables: Only valid for the current session, other sessions and new session are not affected, session end value is destroyed;

Second, see the variables for MySQL: 1. View the variables that can be defined in the configuration file:
shell> mysqld--help--verbose
2. Check the current runtime variables of the MySQL service:
"' ];mysql> SELECT @@{global|  SESSION}. Variable_name;mysql> SELECT * from INFORMATION_SCHEMA. Global_variables WHERE variable_name='variable_name'; MySQL> SELECT * FROM Information_schema. Session_variables WHERE variable_name='variable_name';
Third, modify the MySQL variable: 1. Modify the configuration file:

With configuration file modification, you only need to specify the variable and value in the configuration file, restart the service, for example:

Shell> vim/etc/my.cnf
1
Shell> Service mysqld Restart

Variables modified through the configuration file are permanently active.

2. Direct modification at runtime:

The run-time modification uses the SET command and specifies the variable type (global or session) to assign a value to, for example:

11

It is important to note that the values that are modified at run time in the global variable are not permanently valid, are invalidated after a reboot, and are invalidated if the session variable is the.

MySQL service-MySQL variable type and variable settings

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.