;

How to check MySQL version

Try it in our public cloud & Get $5 Credit
CLAIM NOW
How to check MySQL version

How to check MySQL version

If you are a database administrator or system administrator, it is essential to know how to check version of MySQL you have installed. This will helps you to find which feature is available for your installed MySQL version. For example, if you want to install some application that requires a specific MySQL version. In this case, you will need to find out the MySQL version in your server before installing your application.

There are several ways to check the MySQL version in Linux operating systems.

Check MySQL Version with Command Line

The simple and easiest way to find the MySQL version installed on your system using the MySQL client command.

Option 1: Open your terminal interface and run the following command:

mysql -V

You should get the MySQL version in the following output:

  mysql  Ver 8.0.19 for Linux on x86_64 (MySQL Community Server - GPL)

Type "mysql -v" into SSH console to check mysql version.

Option 2: You can also check the MySQL version by login to MySQL Shell:

mysql -u root -p

Provide your root password (can be your any database user) and hit Enter to log in to MySQL shell as with version information shown below:

Enter password: 
 Welcome to the MySQL monitor.  Commands end with ; or \g.
 Your MySQL connection id is 9
 Server version: 8.0.19 MySQL Community Server - GPL
 Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
 Oracle is a registered trademark of Oracle Corporation and/or its
 affiliates. Other names may be trademarks of their respective
 owners.
 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Type the following syntax to log to MySQL via SSH Console: mysql -u user -p; were "user" is the your mysql user.

Check MySQL Version Within MySQL Shell

You can also verify the MySQL version by querying the version variables inside the MySQL shell.

Step 1: First, log in to MySQL Shell with the following command:

mysql -u root -p

Provide your root password and hit Enter to log in the MySQL shell.

Step 2: Next, run the following command to display the MySQL version into mysql prompt:

SHOW VARIABLES LIKE "%version%";

You should get the following output with, were you can find the MySQL version:

 +--------------------------+-------------------------------+
 | Variable_name            | Value                         |
 +--------------------------+-------------------------------+
 | immediate_server_version | 999999                        |
 | innodb_version           | 8.0.19                        |
 | original_server_version  | 999999                        |
 | protocol_version         | 10                            |
 | slave_type_conversions   |                               |
 | tls_version              | TLSv1,TLSv1.1,TLSv1.2,TLSv1.3 |
 | version                  | 8.0.19                        |
 | version_comment          | MySQL Community Server - GPL  |
 | version_compile_machine  | x86_64                        |
 | version_compile_os       | Linux                         |
 | version_compile_zlib     | 1.2.11                        |
 +--------------------------+-------------------------------+
 11 rows in set (0.02 sec)

Type the following command into mysql shell, to see your mysql version: SHOW VARIABLES LIKE "%version%";

Alternative option: You can also use the SELECT VERSION() statement inside MySQL shell to display MySQL version information:

SELECT VERSION();

You should get the following output:

 +-----------+
 | VERSION() |
 +-----------+
 | 8.0.19    |
 +-----------+
 1 row in set (0.00 sec) 

Into the MySQL Shell, type "SELECT VERSION();" to check the MySQL version.

Another alternative option: The STATUS command also displays the information about MySQL version and the server status:

STATUS;

You should get the following output:

 mysql  Ver 8.0.19 for Linux on x86_64 (MySQL Community Server - GPL)
 
 
 Connection id: 10
 Current database: 
 Current user: root@localhost
 SSL: Not in use
 Current pager: stdout
 Using outfile: ''
 Using delimiter: ;
 Server version: 8.0.19 MySQL Community Server - GPL
 Protocol version: 10
 Connection: Localhost via UNIX socket
 Server characterset: utf8mb4
 Db     characterset: utf8mb4
 Client characterset: utf8mb4
 Conn.  characterset: utf8mb4
 UNIX socket: /var/run/mysqld/mysqld.sock
 Binary data as: Hexadecimal
 Uptime: 16 min 55 sec
 
 
 Threads: 2  Questions: 14  Slow queries: 0  Opens: 132  Flush tables: 3  Open tables: 52  Queries per second avg: 0.013

Into the MySQL Shell, type "STATUS;" to check the MySQL version.

Check MySQL Version from PHPMyAdmin Interface

PHPMyAdmin is a graphical interface for managing the databases. You can also verify the MySQL version from the PHPMyAdmin interface.

Step 1: Open your web browser and type the URL bellow. You will be redirected to the PHPMyAdmin login page:

phpmyadmin url

Then you should see the phpMyAdmin login page:

Phpmyadmin login page.

Step 2: Provide your MySQL root username and password, and click on the Go button. You should see the PHPMyAdmin web interface in the following screen:

When logged into phpmyadmin, you can see the mysql version into the "database server" panel.


In the above screen, you should see the MySQL version information under the “Database server” section on the right side.

Conclusion

In the above guide, you have seen how to check the MySQL version in Linux with several methods. You have also learned how to get additional data from within the MySQL client.