mariadb
command-line client for MariaDB database server
TLDR
Connect to database
SYNOPSIS
mariadb [-u user] [-p] [-h host] [-e command] [options] [database]
DESCRIPTION
mariadb is the command-line client for MariaDB database server. It provides an interactive SQL shell and can execute commands from files or command line.
The client connects to MariaDB or MySQL servers, as MariaDB maintains wire protocol compatibility. Interactive mode provides command history, editing, and tab completion.
Batch mode (-B) produces tab-separated output suitable for scripting. Combined with -N to skip headers, output can be processed by other tools.
Safe updates mode prevents UPDATE and DELETE without WHERE clauses, protecting against accidental data loss.
SSL connections encrypt traffic between client and server. Certificate verification can be configured for production environments.
The client supports pipelining SQL from files, enabling automated database migrations and backups restoration.
PARAMETERS
-u USER, --user USER
Username for connection.-p[PASSWORD], --password[=PASS]
Prompt for or specify password.-h HOST, --host HOST
Server hostname.-P PORT, --port PORT
Server port.-S SOCKET, --socket SOCKET
Unix socket file.-D DB, --database DB
Database to use.-e CMD, --execute CMD
Execute command and exit.-B, --batch
Batch mode (no formatting).-N, --skip-column-names
Don't show column names.-t, --table
Output as table.--ssl
Enable SSL.-A, --no-auto-rehash
Disable auto-completion.--safe-updates
Prevent accidental large updates.-v, --verbose
Verbose output.
CAVEATS
Password on command line visible in process list - use -p without argument. Large result sets may exhaust memory. Interactive features require readline.
HISTORY
MariaDB was created by Michael Widenius (Monty) after MySQL was acquired by Oracle in 2010. MariaDB is a community-developed fork designed to remain free and open-source. The mariadb client replaced mysql as the default client name in recent versions.
SEE ALSO
mariadb-dump(1), mysql(1), mysqldump(1), mariadb-admin(1)
