• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Check MySQL Version

Written by Admin, Updated On May 22, 2020
mariadb, mysql
How to Check the MySQL Version

MySQL is one of the most popular open-source RDBMS (Relational database management system). MySQL provides some features for particular version numbers and on particular platforms only, so knowing which version is running on your server is really important. In this quick tutorial, we’ll explain how to check the MySQL or MariaDB version on your server.

Using Command Line#

The MySQL server binary is named mysqld. Run the binary using -V or --version to get the server version:

mysqld --version

In output you will see information about the MySQL version and exit.

mysqld Ver 5.7.30-0ubuntu0.18.04.1 for Linux on x86_64 ((Ubuntu))

In this example, MySQL server version is 5.7.30.

You also can use the mysqladmin is a client utility to check the version:

mysqladmin -V
mysqladmin Ver 8.42 Distrib 5.7.30, for Linux on x86_64

You will see some difference in output as compare to previous command.

From the MySQL Shell#

You can use the MySQL Client Tools to find version details. To connect to the MySQL server simply type mysql:

mysql

The version will be display on screen once you connected to MySQL shell:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.30-0ubuntu0.18.04.1 (Ubuntu)

If you would like to get more details about MySQL and it’s components, run command as following:

SHOW VARIABLES LIKE "%version%";
+-------------------------+-------------------------+
| Variable_name           | Value                   |
+-------------------------+-------------------------+
| innodb_version          | 5.7.30                  |
| protocol_version        | 10                      |
| slave_type_conversions  |                         |
| tls_version             | TLSv1,TLSv1.1,TLSv1.2   |
| version                 | 5.7.30-0ubuntu0.18.04.1 |
| version_comment         | (Ubuntu)                |
| version_compile_machine | x86_64                  |
| version_compile_os      | Linux                   |
+-------------------------+-------------------------+
8 rows in set (0.00 sec)

Another way to show the MySQL version details is using STATUS command:

STATUS;

From The PHPMyAdmin Interface#

If you are not familiar with command line through ssh and have access to PhpMyAdmin on server then you can easily check the MySQL version. Once you will logged in on PhpMyAdmin, at right side you will see a box named “Database server”. In this box it will show server version of MySQL as given in following:

mysql-version-linux

Using PHP#

If you don’t have access to command line or PhpMyAdmin interface and running on shared hosting, you can check the version using PHP.

Create a new version.php PHP file and add following lines to it:

<?php

// Create a database connection.
$link = mysqli_connect("localhost", "MYSQL_USERNAME", "MYSQL_PASSWORD");

// Print the MySQL version.
echo mysqli_get_server_info($link);

// Close the connection.
mysqli_close($link);

Now upload this file to your document root directory using a FTP or SFTP client. Make sure you have to change MYSQL_USERNAME and MYSQL_PASSWORD with your real MySQL account details.

Open this file with your web browser and it will display MySQL version on screen.

5.7.30-0ubuntu0.18.04.1

Conclusion#

In this tutorial, you have learned how to check the MySQL version with several different methods.

Feel free to leave a comment if you have any questions.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article How to Create a File in Linux
Next Article   How to Install VirtualBox on Ubuntu 20.04

Related Posts

  • How to Install MySQL on Debian 11

    How to Install MySQL on Debian 11

    November 28, 2022
  • How to Install MySQL on Ubuntu 22.04

    How to Install MySQL on Ubuntu 22.04

    November 27, 2022
  • How to Install MariaDB on Ubuntu 22.04

    How to Install MariaDB on Ubuntu 22.04

    November 24, 2022

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install SSH Keys on Ubuntu 22.04
    How to Set up SSH Keys on Ubuntu 22.04 January 7, 2023
  • How to Install Mongodb on Debian 11
    How to Install MongoDB on Debian 11 Linux January 11, 2023
  • How to Install Puppet Agent on Ubuntu 22.04
    How to Install Puppet Agent on Ubuntu 22.04 January 22, 2023
  • How to Install Python 3.11 on Debian 11
    How to Install Python on Debian 11 January 25, 2023
  • How to Change-Hostname Ubuntu 22.04
    How to Change Hostname on Ubuntu 22.04 January 19, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook