--execute (-e)
This page is part of MariaDB's Documentation.
The parent of this page is: mariadb-shell for MariaDB Shell
Topics on this page:
Overview
In 23.03, 23.02, 23.01, 22.12:
Executes a sql statement and returns a result.
In 22.10:
Not present
See also: mariadb-shell for MariaDB Shell, in 23.02, in 23.01, in 22.12, and in 22.10
USAGE
mariadb-shell [{--execute | -e} '<SQL_statement>']
DETAILS
Option | Default Behavior | Argument |
---|---|---|
--execute -e | If omitted, MariaDB Shell executes statements from standard input or from the interactive shell | A string containing an SQL statement |
EXAMPLES
To execute an SQL statement on a remote host:
$ mariadb-shell \
--host host.example.com \
--user user_name \
--password 'user_password' \
--execute "SHOW GLOBAL VARIABLES LIKE 'gtid_%';"
+-------------------------+----------+
| Variable_name | Value |
+-------------------------+----------+
| gtid_binlog_pos | 0-100-92 |
| gtid_binlog_state | 0-100-92 |
| gtid_cleanup_batch_size | 64 |
| gtid_current_pos | 0-100-92 |
| gtid_domain_id | 0 |
| gtid_ignore_duplicates | OFF |
| gtid_pos_auto_engines | |
| gtid_slave_pos | |
| gtid_strict_mode | OFF |
+-------------------------+----------+
To use the short option names:
$ mariadb-shell \
-h host.example.com \
-u user_name \
-p 'user_password' \
-e "SHOW GLOBAL VARIABLES LIKE 'gtid_%';"
CHANGE HISTORY
Release Series | History |
---|---|
23.03 |
|
23.02 |
|
23.01 |
|
22.12 |
|
22.10 |
|