Here are six ways to check what version of MariaDB you’re currently running.
Option 1: The @@version
Variable
The @@version
variable contains the server version number. It may also include a suffix with configuration or build information.
You can retrieve its contents with a simple SELECT
statement.
Example:
SELECT @@version;
Result:
+----------------+ | @@version | +----------------+ | 10.5.9-MariaDB | +----------------+
Option 2: The VERSION()
Function
The VERSION()
function returns the same information – the server version number, which may also include a suffix with configuration or build information.
This can be called using a SELECT
statement. No arguments are required (or accepted).
Example:
SELECT VERSION();
Result:
+----------------+ | VERSION() | +----------------+ | 10.5.9-MariaDB | +----------------+
Option 3: The SHOW VARIABLES
Statement
The SHOW VARIABLES
statement shows the values of MariaDB system variables.
You can use a WHERE
clause to narrow the variables to just the version
variable.
Example:
SHOW VARIABLES
WHERE variable_name = 'version';
Result:
+---------------+----------------+ | Variable_name | Value | +---------------+----------------+ | version | 10.5.9-MariaDB | +---------------+----------------+
Alternatively, you can use a LIKE
operator to return other variables that have version
in their name.
Example:
SHOW VARIABLES
WHERE variable_name LIKE '%version%';
Result:
+-----------------------------------+------------------------------------------+ | Variable_name | Value | +-----------------------------------+------------------------------------------+ | in_predicate_conversion_threshold | 1000 | | innodb_version | 10.5.9 | | protocol_version | 10 | | slave_type_conversions | | | system_versioning_alter_history | ERROR | | system_versioning_asof | DEFAULT | | tls_version | TLSv1.1,TLSv1.2,TLSv1.3 | | version | 10.5.9-MariaDB | | version_comment | Homebrew | | version_compile_machine | x86_64 | | version_compile_os | osx10.16 | | version_malloc_library | system | | version_source_revision | 3a8ca9096ea82ca61811450775511533d6cb1bb4 | | version_ssl_library | OpenSSL 1.1.1k 25 Mar 2021 | | wsrep_patch_version | wsrep_26.22 | +-----------------------------------+------------------------------------------+
Option 4: The STATUS
Command
You can type STATUS
any time you’re logged in to return information about the MariaDB version and other details.
Example:
STATUS;
Result:
mariadb Ver 15.1 Distrib 10.5.9-MariaDB, for osx10.16 (x86_64) using readline 5.1 Connection id: 11 Current database: PetHouse Current user: barney@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server: MariaDB Server version: 10.5.9-MariaDB Homebrew Protocol version: 10 Connection: Localhost via UNIX socket Insert id: 4 Server characterset: utf8mb4 Db characterset: utf8mb4 Client characterset: utf8 Conn. characterset: utf8 UNIX socket: /tmp/mysql.sock Uptime: 7 days 23 hours 50 min 3 sec Threads: 1 Questions: 411 Slow queries: 0 Opens: 41 Open tables: 25 Queries per second avg: 0.000
Option 5: Login to MariaDB
When you first log in to MariaDB, the version number is presented within the “Welcome” message.
For example, opening a new terminal window and running the following command connects to MariaDB:
mariadb --auto-vertical-output
And the following “Welcome” (or similar) message is displayed:
Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 4 Server version: 10.5.9-MariaDB Homebrew Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Option 6: The --version
Option
If you don’t have MariaDB open, you can find out what version it is by using the --version
(or -V
) option of the mariadb
, mariadb-admin
, and mysqladmin
programs.
For example, opening a new terminal window and running the following command:
mariadb --version
Returns the following:
mariadb Ver 15.1 Distrib 10.5.9-MariaDB, for osx10.16 (x86_64) using readline 5.1
Running the following command:
mariadb-admin --version
Returns the following:
mariadb-admin Ver 9.1 Distrib 10.5.9-MariaDB, for osx10.16 on x86_64
And running the following command:
mysqladmin --version
Returns the following:
mysqladmin Ver 9.1 Distrib 10.5.9-MariaDB, for osx10.16 on x86_64
The --version
part can alternatively be shortened to just --V
.
Example:
mariadb-admin -V
Returns the following:
mariadb-admin Ver 9.1 Distrib 10.5.9-MariaDB, for osx10.16 on x86_64