mariadb-shell for MariaDB Shell

Overview

The mariadb-shell utility, which is also called MariaDB Client, provides SQL shell access to MariaDB Shell. It supports both interactive and non-interactive use.

mariadb-shell Options for MariaDB Shell

Connection Options

Option

Argument

Description

--connect-timeout (-t)

CONNECT_TIMEOUT

Number of seconds to wait for the server response during the initial handshake before the connection times out.

--database (--db, -D, -d)

[DATABASE]

The database to use after connecting.

--delimiter

[DELIMITER]

Sets the delimiter for the session.

--dsn (--url)

DSN

A formatted URL string, i.e., mariadb://user:password@hostname:port/database

--host (-h)

[HOST]

Hostname or IP address to use for the connection.

--no-replicate (--local, --no-binlog, -l)

Suppress commands from being written to MariaDB binary logs. [DANGEROUS]

--password (-p)

[PASSWORD]

Password

--pidfile

PIDFILE

The full path to a local MariaDB pidfile (intended to be combined with -l / --no-replicate / --no-binlog / --local).

--port (-P)

PORT

Port to connect to

--profile

PROFILE

Specifies a profile defined in ~/.msh.cnf to use for the connection.

--protocol

[PROTOCOL]

Protocol or driver to use. Possible values: mariadb, mysql, xpand, max, maxscale

--protocol-timeout

PROTOCOL_TIMEOUT

Timeout in seconds for auto-detection of protocol or driver to use, default: 10 seconds

--skip-column-names (-N)

Skips column names on output formats

--socket (-s)

[SOCKET]

MariaDB socket file

--ssl-ca

SSL_CA

TLS CA Certificate in PEM format

--ssl-capath

SSL_CAPATH

Certificate path

--ssl-cert

SSL_CERT

x509 Certificate in PEM format

--ssl-cipher

SSL_CIPHER

TLS cipher

--ssl-key

SSL_KEY

x509 Key in PEM format

--ssl-verify-server-cert

SSL_VERIFY_SERVER_CERT

Verify common name of server in its certificate against the hostname. Disabled by default.

--tls-version

TLS_VERSION

TLS protocol version to use for connection (optional)

--user (-u)

[USER]

The username to use for the connection.

--wait-for-replicas

Instructs MariaDB Shell to wait for replicas to finish replicating binlogs before shutdowns.

Included for Compatibility

Option

Argument

Description

--character-sets-dir

Provided for compatibility with mariadb client.

--compress (-C)

Provided for compatibility with mariadb client.

--no-beep

Provided for compatibility with mariadb client.

System Configuration Options

Option

Argument

Description

--color (-c)

[COLORBLIND]

Turns the text color on (auto or 1) or off (off or 0).

--daemon

For various tools bundled into MariaDB Shell, runs them in a daemonized fashion.

--debug

Enable debugging features

--execute (-e)

EXEC

Executes a sql statement and returns a result.

--force

--generate-defaults

Generates default cnf entries and appends to the found file or creates one in ~/.msh.cnf

--output (-o)

{json,json pretty,xml,mysql,classic,csv,tsv,sqlplus,html,modern,none}

Output stylings

--pager

PAGER

Sets the pager for the internal cli.

--progress

Sets a progress bar flag for all operations

--raw (-r)

Removes escape characters for certain output formats.

--show-warnings

Show warnings after every statement

--ssh-host (-rh, -sh)

SSH_HOST

The ip address or url to use to connect to the remote host

--ssh-key (-rk, -sk)

SSH_KEY

The private key to use to connect to the remote host

--ssh-key-pass (-rkp, -skp)

[SSH_KEY_PASS ...]

The private key passphrase to use

--ssh-pass (-rp, -sp)

[SSH_PASS ...]

The password to use to connect to the remote host

--ssh-port (-rP, -sP)

SSH_PORT

The port to use to connect to the remote host

--ssh-user (-ru, -su)

SSH_USER

The username to use to connect to the remote host

--store-connection-settings

Stores current connection settings for selected profile (implies --profile,overwriting or creating a new one)

--verbose (-v)

Enables more verbose output.

--version

show program's version number and exit

Integration With MariaDB Tools

The MariaDB Shell can also execute "MariaDB Tools" commands using the MariaDB Shell command-line. To do so, the first non-option argument will be one of the following tool names. The only options that can occur prior to the tool name are System Configuration Options (not Connection Options). The options that come after the tool name are interpreted by the tool itself, so see the linked tool page for its option handling.

The MariaDB Tools package must be installed for these to work. If an executable is not available, and error is displayed. For installation instructions, see the Install MariaDB Shell section.

First Argument

Description

align-output

executes mariadb-align-output via msh

archiver

executes mariadb-archiver via msh

backup-manager

executes mariadb-backup-manager via msh

config-diff

executes mariadb-config-diff via msh

database-summary

executes mariadb-database-summary via msh

index-checker

executes mariadb-index-checker via msh

iostat

executes mariadb-iostat via msh

kill

executes mariadb-kill via msh

parted

executes mariadb-parted via msh

query-digest

executes mariadb-query-digest via msh

schema-change

executes mariadb-schema-change via msh

stat

executes mariadb-stat via msh

stat-browser

executes mariadb-stat-browser via msh

status-diff

executes mariadb-status-diff via msh

summary

executes mariadb-summary via msh

system-summary

executes mariadb-system-summary via msh