mariadb-client

Documents MariaDB command-line client behavior for writing and reviewing shell commands and scripts.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? LLMs frequently generate incorrect mariadb CLI commands based on outdated MySQL-era assumptions, such as expecting boxed output in batch mode, using the nonexistent sql_max_join_size variable, or assuming a latin1 default charset. This Skill provides the MariaDB-specific facts needed to write, generate, and review correct CLI invocations. ## Core Features & Use Cases - Batch vs. interactive behavior: Explains that piped input, -e, or --batch auto-switches to tab-separated output and disables the history file, with --table to force boxed output back. - Safety guardrails: Covers --safe-updates semantics, including that it sets max_join_size (no sql_ prefix) and blocks UPDATE/DELETE without a key-based WHERE or LIMIT. - Client-side commands and charset handling: Details DELIMITER for stored-routine bodies, \G vertical output, locale-based charset auto-detection, and the mysql symlink compatibility. - Use Case: When asked to write a migration script that runs mariadb appdb < migration.sql, the Skill ensures the agent accounts for batch-mode output, --force error handling, and correct password flag syntax (-pmypassword, not -p mypassword). ## Quick Start Ask the AI to write a shell command that runs a SQL migration file against a MariaDB database using the mariadb client with safe-updates enabled.

Frequently Asked Questions about mariadb-client

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

FAQPage Schema
How do I run a SQL script with the mariadb command-line client?▼

Run a SQL script by piping or redirecting it into the client, for example `mariadb dbname < script.sql`. Non-interactive input automatically enables batch mode with tab-separated output and disables the history file; add `--force` to continue past errors.

How to create a stored procedure using the mariadb CLI?▼

Create stored procedures by wrapping the body with the client-side `DELIMITER` command: set `DELIMITER //`, write the `BEGIN...END` body ending with `END //`, then restore `DELIMITER ;`. The client, not the server, splits statements on the delimiter.

Is the mysql command still available in MariaDB?▼

Yes, `mysql` is kept as a symlink to the same `mariadb` binary on Unix, and `mysql.exe` ships as an alternate binary on Windows. Both invoke the identical client, so scripts using either name behave the same.

Why does mariadb client output look different when piped?▼

Piped or redirected input triggers batch mode, which switches output to tab-separated unboxed format and enables `--silent`. Force the boxed table format back with `--table`/`-t`, or use `--vertical`/`-E` or a trailing `\G` for vertical output.

Does --safe-updates use sql_max_join_size to limit joins?▼

No, the session variable is `max_join_size` without the `sql_` prefix, so `SET sql_max_join_size` fails. `--safe-updates` issues `SET SQL_SAFE_UPDATES=1, SQL_SELECT_LIMIT=n, MAX_JOIN_SIZE=n` as an init command, tunable via `--select-limit` and `--max-join-size`.

Why is my mariadb client showing mangled characters?▼

The client auto-detects the charset from the OS locale at connect time rather than defaulting to latin1, falling back to utf8mb4. If terminal output looks wrong, set `--default-character-set=utf8mb4` explicitly instead of assuming a legacy default.