MySQL is a relational database management system. At the writing time of this tutorial MySQL 8 is the latest version available. This tutorial helps you to check the MySQL server version running on your system.
Find Version with “mysqld” Command
Use mysqld
command with -V
option to check MySQL version running on localhost system. The below examples can only used for the localhost only.
mysqld -V
Output:
/usr/sbin/mysqld Ver 8.0.25-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))
The above result shows that you are running MySQL version 8.0.25 on your local system.
Using “SELECT VERSION” Statement
You can also obtain the version from within the MYSQL shell by typing the SELECT VERSION() statement:
SELECT VERSION();
Output:
+-------------------------+
| VERSION() |
+-------------------------+
| 8.0.25-0ubuntu0.20.04.1 |
+-------------------------+
1 row in set (0.00 sec)
Using “SHOW VARIABLES” Statement
You can also find the MySQL version information, which is stored in a variable named version
. Type the below statement to view the MySQL server version.
SHOW VARIABLES LIKE "%version%";
Check MySQL Version During Connection
You can also check the MySQL version with a log-in to MySQL command-line interface. When we connect to the MySQL shell, it displays a welcome message including the MySQL version running on the system.
This method can be used to check MySQL versions running on localhost as well as on the remote hosts.
mysql -u root -p
This tutorial helps you to check the MySQL version running on localhost or a remote host. If you don’t have MySQL installed on your Linux machine you can check another post How to Install MySQL 8.0 on Ubuntu?