mariadb-set

Generates and reviews MariaDB SET statements with correct scope, privilege, and persistence semantics.

28|115|Updated Jan 28, 2025
One-click install
npx skills add https://github.com/mariadb-corporation/mariadb-docs --skill mariadb-set-mariadb-corporation
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: mariadb-set
Source: https://github.com/mariadb-corporation/mariadb-docs/tree/main/agent-skills/granular/statements/mariadb-set
Command: npx skills add https://github.com/mariadb-corporation/mariadb-docs --skill mariadb-set-mariadb-corporation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Generic SQL knowledge leads agents to write SET statements that fail or misbehave on MariaDB — using nonexistent SET PERSIST syntax, wrong privilege names like SYSTEM_VARIABLES_ADMIN, or expecting SET GLOBAL to affect the current session. This Skill encodes MariaDB's actual SET grammar, scope rules, and the SET STATEMENT ... FOR extension so generated statements work correctly. ## Core Features & Use Cases - Scope and privilege correctness: Enforces GLOBAL/SESSION/LOCAL rules, the SUPER privilege gate on SET GLOBAL, and hard-error behavior (ERROR 1228/1229) for wrong-scope assignments. - SET STATEMENT ... FOR extension: Applies per-query variable overrides with automatic restore, including the fixed list of 13 unsupported variables and the parse-before-effect trap. - Persistence and reset semantics: Clarifies that MariaDB has no SET PERSIST (config files persist settings) and documents var = DEFAULT restore behavior for session versus global scope. - Use Case: When asked to raise max_connections for a MariaDB server, produce SET GLOBAL max_connections=500 plus a config-file change for restart persistence, instead of invalid SET PERSIST syntax. ## Quick Start Ask the AI to write or review a MariaDB SET statement, such as scoping max_statement_time to a single query with SET STATEMENT ... FOR.

Frequently Asked Questions about mariadb-set

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set a global variable in MariaDB?▼

Use SET GLOBAL var_name = value, which requires the SUPER privilege by default. The change affects only new connections, not the current session, and does not survive a restart unless you also update the server configuration file.

Does MariaDB support SET PERSIST like MySQL?▼

No, MariaDB has no SET PERSIST or PERSIST_ONLY keyword in its grammar. To make a setting survive a restart, run SET GLOBAL for the live server and separately write the value into a configuration file such as /etc/mysql/mariadb.conf.d/.

How do I set a variable for just one query in MariaDB?▼

Use the MariaDB extension SET STATEMENT var=value FOR your_statement, which applies the value for that single statement and restores the prior session value afterward. Note that 13 variables, including wait_timeout and autocommit, cannot be set this way.

Why does SET GLOBAL not change my current session in MariaDB?▼

SET GLOBAL only changes the server-wide default applied to new connections; already-open sessions keep their existing values. Reconnect, or read @@global.var explicitly, to observe the new value.

What is the difference between = and := for user variables in MariaDB?▼

Inside a SET statement, both SET @x = 5 and SET @x := 5 are accepted for user variables. Everywhere else, such as inside a SELECT expression, only the := operator performs assignment, since plain = is treated as comparison.

Why does SET STATEMENT fail with certain variables in MariaDB?▼

A fixed list of 13 variables, including autocommit, character_set_client, wait_timeout, and sql_log_off, cannot be set via SET STATEMENT and raise ER_SET_STATEMENT_NOT_SUPPORTED. For those, use the manual save, SET SESSION, and restore pattern instead.