Having a MySQL instance is quite normal in a server or workstation where you work with database connections with this program. The problem arises when we do not know the version of MySQL that the system has. And this can cause some compatibility issues with applications. The solution? Read this post, where you will learn how to check the MySQL version on Linux.
I don’t know if it is the most popular, but MySQL is for sure one of the most important database managers that you can use, even if it has MariaDB as a competitor. For this very reason, many applications use it as their trusted data manager.
On the other hand, if you are a developer, or you are responsible for an already functional server, it is necessary that you know which MySQL version it is. The reason there are applications that require a specific version of MySQL, so before using or installing them you should have the answer.
So, we will show you different commands and ways to achieve the goal.
How to verify the MySQL version
If you already have MySQL on your system, you can check the installed version in several ways. However, I think the best way is to do it through the terminal interface because that way you can be sure that it will work on any distribution.
Method 1: Displaying the MySQL version using commands
The fastest way to display the installed version of MySQL is to use the
mysql command with which you can, among other things, access the shell, but also execute commands.
So, connect via SSH to your server or open a terminal from the main menu and display the version by running:
And you will get an output screen like this:
mysql Ver 8.0.29 for Linux on x86_64 (MySQL Community Server - GPL)
Alternatively, you can use the
And you should get the same result.
Method 2: Using the MySQL console to get the MySQL version
Another way to do this is to use the MySQL console. To access it, you have to run.
sudo mysql -u root -p
And as soon as you log in, you will see the MySQL server information.
It is that simple.
If for some reason you couldn’t see it, you can always run the
status command to check MySQL options.
Actually, the value we checked is:
Server version: 8.0.29 MySQL Community Server—GPL
If you want additional information, you can run this command:
SHOW VARIABLES LIKE "%version%";
This way, more information about MySQL and the system where you are running it will be shown on the screen.
As you can see, it is simple.
Knowing the MySQL version on the system can save us some headaches in terms of application compatibility and even in terms of configurations.
I hope you liked this post and help us grow by sharing it.