--execute (-e)

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

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

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_%';"

ERROR HANDLING

FEATURE INTERACTION

RESPONSES

DIAGNOSIS

ISO 9075:2016

CHANGE HISTORY

Release Series

History

23.03

  • Present starting in MariaDB Shell 23.03.1.

23.02

  • Present starting in MariaDB Shell 23.02.1.

23.01

  • Present starting in MariaDB Shell 23.01.1.

22.12

  • Added in MariaDB Shell 22.12.1.

22.10

  • Not present.

EXTERNAL REFERENCES