Home  >  Article  >  Database  >  What are the types of system variables in mysql

What are the types of system variables in mysql

WBOY
WBOYforward
2023-04-17 19:07:061776browse

1. Global variables, scope: valid for all sessions (connections), but not across restarts

查看所有全局变量
SHOW GLOBAL VARIABLES;
 
查看满足条件的部分系统变量
SHOW GLOBAL VARIABLES LIKE '%char%';
 
查看指定的系统变量的值
SELECT @@global.autocommit;
 
为某个系统变量赋值
SET @@global.autocommit=0;
SET GLOBAL autocommit=0;

2. Session variables, scope : Valid for the current session (connection)

查看所有会话变量
SHOW SESSION VARIABLES;
查看满足条件的部分会话变量
SHOW SESSION VARIABLES LIKE '%char%';
 
查看指定的会话变量的值 (session可省略)
SELECT @@autocommit;
SELECT @@session.tx_isolation;
 
为某个会话变量赋值 (session可省略)
SET @@session.tx_isolation='read-uncommitted';
SET SESSION tx_isolation='read-committed';

The above is the detailed content of What are the types of system variables in mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete