How to modify MySQL Environment Variables

Source: Internet
Author: User

The MySQL environment variable method may not be available to anyone. The following describes how to modify the MySQL environment variable for your reference. I hope it will help you learn MySQL environment variables.

MySQL can modify the environment variable values in two ways: the configuration file my. ini for win | my. cnf for linux) and the mysql Command (dynamic modification ).

The command for displaying system variables in MySQL is: show variables;

Adjust the system variables of the MySQL server

The mysqld server maintains two types of environment variables.

Global variables affect global operations on the server. Session variables affect operations related to client connection. When the server is started, all global variables are initialized to the default value. You can change these default values by specifying options in the option file or command line. After the server is started, you can change the dynamic GLOBAL variables by connecting to the server and executing the set global var_name statement. To change global variables, you must have the SUPER permission.

The mysqld server also maintains session variables for each client connection. The client session variable is initialized using the current value of the corresponding global variable during connection. You can use the SET [SESSION] var_name statement to change the dynamic SESSION variable. You do not need special permissions to set session variables, but you can only change your session variables without changing the session variables of other customers.

There are two types of commands: session level and global level.
The session level takes effect immediately after the setting. The environment variable becomes invalid after the connection is disconnected.
Set session sort_buffer_size = 10000 (no permission required)

Global does not take effect immediately but takes effect for the new connection.
Set global sort_buffer_size = 100000 requires the SUPER permission)

Example of defining MySQL transactions

Example of creating a MySQL Stored Procedure

Mysql Stored Procedure Call Method

MySQL DATEDIFF () syntax

MySQL date functions

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.