MySQL or MariaDB is very popular opensource databases servers. While using these database servers we may need to know the version of the client or server. We can use features according to these version numbers. In this tutorial we will look how to list MySQL and MariaDB database server versions.
mysql –version Command
mysql
is a client command used to connect and manage database server. We can use --version
option in order to print the version of the mysql client. If the database service runs in the same system this will also print the server version too.
$ mysql --version

Package Manager
We can use package manager of the system. This can be apt
, yum
or dnf
. In this case we will use apt
with the show
option .
$ apt show mysql-server

As we can see from line Version:
the version is 5.7.23
MySQL Client
In the first connection of the MySQL server some basic information about the server is listed. MySQL server version is one of them. The line starting with Server version:
will show the current version of the MySQL server.
$ sudo mysql -u root -p

Server Variables
MySQL server variables are stored in the VARIABLES
variable. We can use VARIABLES
and fileter for version
information like and SQL statement.
> SHOW VARIABLES LIKE "%version%";

As we can see also following information is provided too.
- innodb_version
- protocol_version
- tls_version
- version
- version_comment
- version_compile_machine
- version_compile_os
STATUS MySQL Command
MySQL also provides the STATUS
command which is used to current status of the MySQL server. We can this command to print MySQL server version and other server related information like Connection, Current User, Connection Id etc.
> STATUS;

As we can see that following information is provided too
- Connection id
- Current database
- Current user
- SSL
- Server version
- Protocol version
- Connection
- Server characterset
- Db characterset
- Client characterset
- Conn. characterset
- UNIX socket
- Uptime
- Threads
Mysql is the query language of the database which help you to store, create, delete data in the database. the code given is really important for us. This helps you to get the version of your database.