MariaDB Client
$ mariadb Official High Riskmariadb is the official command-line client for MariaDB (and MySQL-compatible servers), supporting headless queries via -e, tab-separated --batch --raw output, --xml, and --safe-updates. While reliable for scripting, it lacks a native --json output flag.
brew install mariadb Direct mariadb -e --batch invocations avoid MCP overhead and preserve exact SQL semantics and streaming.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Predictable -e + --batch --raw non-interactive execution and --xml/--html modes, but lacks a native --json flag and opens an interactive prompt if -e/stdin is omitted.
--batch --rawoutputs clean TSV without ASCII borders- No native
--jsonoutput flag (relies on TSV,--xml, orJSON_OBJECT())
--safe-updates blocks unkeyed UPDATE/DELETE statements and --defaults-extra-file isolates credentials, though there is no client-side --readonly flag.
--safe-updatesprotects against accidental full-table updates/deletes
Available across macOS (brew), Linux packages, and Windows installers.
- Standard distribution across OS package managers
Fast C client handling large SQL dumps, streaming queries, and JSON_OBJECT() queries.
- Efficient streaming of large query results and SQL imports
Official MariaDB Foundation client (MariaDB/server) under GPL-2.0.
- First-party MariaDB Foundation repository
Well-documented MariaDB Knowledge Base page and detailed --help.
- Official Knowledge Base reference
Security, Auth & Guardrails
Reads credentials from ~/.my.cnf (--defaults-extra-file), MYSQL_PWD env var (discouraged), or Unix socket auth.
GPL-2.0 open-source MariaDB Foundation client; free.
# MariaDB Client Agent Rules - Always pass `-e "..." --batch --raw` so `mariadb` runs non-interactively without ASCII box borders. - Enable `--safe-updates` on any non-read-only session and prefer a read-only DB user when inspecting schemas. - Read credentials from `~/.my.cnf` or `--defaults-extra-file` rather than passing `-p<password>` on the command line.
Agent-Ready Command Recipes
Safe Read-Only Queries
mariadb -h 127.0.0.1 -u readonly --batch --raw -e "SHOW TABLES;" app_db
Executes a single read-only SQL statement non-interactively with tab-separated output.
mariadb -h 127.0.0.1 -u readonly --xml -e "DESCRIBE users;" app_db
Returns structured XML describing table columns and types.
Controlled Writes & Previews
mariadb -h 127.0.0.1 -u appuser --safe-updates -e "UPDATE users SET active = 0 WHERE id = 42;" app_db
Enables --safe-updates (--i-am-a-dummy) so UPDATE/DELETE without WHERE keys or LIMIT are rejected.
Strengths for Agents
- +
--batch --rawstrips ASCII table borders for clean TSV parsing. - +
--safe-updatesprevents catastrophicDELETE/UPDATEstatements lackingWHEREkey clauses. - +
--defaults-extra-filekeeps database passwords out of shell arguments.
Caveats & Pitfalls
- ! No native
--jsonCLI output flag; structured serialization requires--xmlor SQLJSON_OBJECT(). - ! Running without
-eor piped stdin opens an interactive SQL prompt.