mariadb: The MariaDB Command-Line Client
The mariadb command is MariaDB's client, drop-in compatible with the mysql client flags for CI use.
MariaDB ships its own client named mariadb, with mysql kept as a compatibility symlink. The flags match the MySQL client, so scripts port directly; the backup tool is mariadb-dump (aliasing mysqldump).
What it does
mariadb connects to a MariaDB or MySQL server and runs SQL, using the same -h/-u/-p/-e flags as the mysql client. Recent MariaDB releases renamed the tools (mariadb, mariadb-dump, mariadb-admin) while keeping the old mysql* names as symlinks, so either name works today.
Common usage
# run one statement (same flags as mysql)
MYSQL_PWD=secret mariadb -h db -u app -e "SELECT VERSION()" appdb
# import a dump
MYSQL_PWD=secret mariadb -h db -u app appdb < dump.sql
# back up with the MariaDB-named dumper
mariadb-dump --single-transaction -h db -u app appdb > dump.sqlOptions
| Flag / tool | What it does |
|---|---|
| -h / -P / -u | Host, port, user (same as mysql) |
| -p[password] | Password; empty prompts, -pSECRET inline |
| -e "<sql>" | Execute one statement and exit |
| mariadb-dump | Backup tool (aliases mysqldump) |
| mariadb-admin ping | Readiness check (aliases mysqladmin) |
In CI
On a MariaDB image, both mariadb and mysql usually exist, so pick one and stay consistent. If a newer image dropped the mysql symlink, a script calling mysql fails with "command not found"; switch to mariadb (and mariadb-dump, mariadb-admin). Readiness gating uses mariadb-admin ping, identical in behavior to mysqladmin ping.
Common errors in CI
"mysql: command not found" on a recent MariaDB image means the compatibility symlink was removed; use mariadb. "ERROR 1045 (28000): Access denied for user" and "ERROR 2002 (HY000): Can't connect to local MySQL server through socket" behave exactly as with the mysql client; pass -h 127.0.0.1 to force TCP and check credentials.