How to Check Version MySQL in Linux? The most widely used open-source relational database management system is MySQL (and its direct replacement Maria DB). Knowing which version of MySQL is installed on your server may be crucial in particular circumstances because there are some significant differences between them.
For instance, you must first determine the version of your MySQL server if you are installing an application that needs a specific version of MySQL in order to complete the installation.
This article will demonstrate How to Check Version MySQL in Linux? or Maria DB server is currently installed on your computer.
By Using the Command Line
You may find the version of your MySQL by using a number of different commands assuming you have SSH access to the server.
MySQL is the name of the MySQL server binary. Run the program while using the version or -V option to obtain the server version:
-version MySQL
The command will exit after printing information about the version of MySQL. The MySQL server used in this example is version 5.7.27:
Linux on x86 64 using MySQL version 5.7.27-0ubuntu0.18.04.1 (Ubuntu)
The client utility mysqladmin is used to carry out administrative tasks on the MySQL servers. Additionally, it can be used to check the MySQL version:
-V mysqladmin
The results will differ slightly from the preceding commands:
mysqladmin Ver 8.42 Distrib 5.7.27, for Linux on x86_64
The MySQL Shell
The version of the MySQL server can also be found by using a command-line client tool like MySQL.
Type MySQL to connect to the MySQL server:
MySQL
The version will be displayed on the screen after you are connected to the MySQL shell:
This is the MySQL monitor, welcome. Commands have a; or g at the end.
It is 3 for your MySQL connection id.
Version 5.7.27-0ubuntu0.18.04.1 of the server (Ubuntu)
Use the version variables to perform a query to obtain details about the MySQL version and other components:
SHOW VARIABLES LIKE “%version%”;
+————————-+————————-+
| Variable name | Value |
+————————-+————————-+
| innodb_version | 5.7.27 |
| protocol version | 10 |
| slave_type_conversions | |
| tls_version | TLSv1, TLSv1.1 |
| version | 5.7.27-0ubuntu0.18.04.1 |
| version comment | (Ubuntu) |
| version_compile_machine | x86_64 |
| version_compile_os | Linux |
+————————-+————————-+
8 rows in set (0.02 sec)
Additional clauses and procedures might also display the server version for you. Only the MySQL version will be shown by the SELECT VERSION () command.
SELECT VERSION () in MySQL
The STATUS command displays the version of MySQL as well as details about the server’s status:
MYSQL>STATUS
Using PHP
How to Check Version MySQL in Linux? You may find out the version of the MySQL server using PHP if you are using shared hosting and don’t have access to the command line or a MySQL client like PHPMyAdmin.
Using an FTP or SFTP client, upload the subsequent PHP file to the document root directory of your website. As soon as you switch my user and my password to a real MySQL user account, be sure to:
MySQL-version.php
<? php
// Create a database connection.
$link = mysqli_connect ("localhost", "my_user", "my password");
// Print the MySQL version.
echo mysqli_get_server_info($link);
// Close the connection.
mysqli_close($link);
Open the file in your browser and the version of the MySQL server will be displayed on your screen:
7.27-0ubuntu0.18.04.1
Conclusion
How to Check Version MySQL in Linux? Finding the MySQL server’s version is a fairly simple process. This tutorial has several different methods for determining the version of MySQL that is installed on your machine.
If you have any questions, don’t hesitate to leave a remark.