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