SHOW [GLOBAL | SESSION] VARIABLES
[LIKE 'pattern' | WHERE expr]
Show variables 接受可选的 global 或 session 变量范围修饰符(variable scope modifier).
- Global, 显示全局系统变量值. 这些值用于在新连接中初始化对应的会话变量.
- Session, 显示在当前连接中生效的全局系统变量的值. Session 与 local 同义.
- 无修饰符, 默认为 session.
示例
-- 查询当前连接'自动提交'的情况
show variables like 'autocommit';
-- or
select @@autocommit;
# 查询当前连接的'事务隔离级别'
show varialbes like 'transaction_isolation';
-- or
select @@transaction_isolation;
参考
[1]https://dev.mysql.com/doc/refman/5.7/en/show-variables.html