Home > Database > Mysql Tutorial > body text

What are the types of system variables in mysql

WBOY
Release: 2023-04-17 19:07:06
forward
1799 people have browsed it

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;
Copy after login

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';
Copy after login

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!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template