System Variables

System variables control the behavior of a session or the entire instance engine. Use SET to change them, subject to privileges and whether a variable can be changed dynamically, and use SHOW VARIABLES to inspect them.

Global and session scopes

Scope

Meaning

Global (GLOBAL)

Affects the default behavior of new sessions. Some values persist for the instance lifecycle.

Session (SESSION)

Applies only to the current connection and expires when it disconnects.

Both

Has both a global default and a session override.

SHOW VARIABLES;
SHOW VARIABLES LIKE 'sql_mode';
SHOW GLOBAL VARIABLES;
SHOW SESSION VARIABLES LIKE '%timeout%';

SET SESSION autocommit = 0;
SET GLOBAL max_allowed_packet = 33554432;  -- Requires sufficient privileges, and the variable must support dynamic modification

Custom user variables such as @var differ from system variables. They temporarily store scalar values within a session. Refer to client usage and statements such as SET @a = ....

Common variables

The following table lists variables commonly encountered in the documentation and product. Refer to SHOW VARIABLES for the complete list.

Variable

Typical purpose

Notes

autocommit

Enables automatic commits

Transaction scripts commonly disable it temporarily.

sql_mode

SQL mode set

Affects strictness, GROUP BY behavior, and more.

character_set_* / collation_*

Character sets and collations

A common default is utf8mb4.

time_zone

Session time zone

Affects TIMESTAMP display and conversion.

lower_case_table_names

Table-name case behavior

Commonly 1 (case-insensitive) and usually should not be changed arbitrarily.

max_allowed_packet

Maximum packet size in bytes

Increase it for large results or statements.

interactive_timeout / net_write_timeout

Idle and write timeouts

Relevant to long-lived connections and slow networks.

auto_increment_increment / auto_increment_offset

Auto-increment step and offset

foreign_key_checks

Enables foreign-key checks

Can be disabled temporarily during bulk loading after consistency risks are assessed.

save_query_result / query_result_*

Query-result persistence

MatrixOne extension capabilities

sql_safe_updates

Safe updates

Restricts updates and deletes without a key or WHERE clause.

Password / login policy variables

Complexity, failure limits, allowlists, and more

Related to instance security policies

Query-result extensions

If query-result persistence is enabled for the instance:

  • save_query_result: Whether to save results.

  • query_result_maxsize / query_result_timeout: Size and retention-time limits.

Whether these capabilities are available to your tenant depends on the console and SHOW VARIABLES.