Check MySQL Version in Linux via Command Line

Posted on

In this article, there will be described several ways used to check the currently running MySQL Database Server. Before checking the version, there are several things before which is needed to be done.

1. The first step which is the most important step is to make sure whether MySQL Database Server has already installed or not. Depends on the package manager or utility used to administer package, program, files or utility used in the current Linux operating system used, the way to do it also vary. One of an example that can be used is taken from the article titled ‘Installing MySQL Server in Ubuntu 16.04‘.

2. After successfully installed MySQL Database Server. The next step is to check whether the service itself which in this context is MySQL Database Server’s service has already up and listening for incoming connection or request. The following article can be a reference to check the current service’s status titled ‘Check MySQL Service Status‘.

3. So, if the service is up and ready to listen for incoming connection, the version can be checked by typing the following command :

mysql --version

Sample of the output execution is shown below :

[user@hostname ~]$ mysql --version
mysql Ver 14.14 Distrib 5.1.71, for redhat-linux-gnu (x86_64) using readline 5.1
[user@hostname ~]$
  1. Another example which can be used is directly access MySQL Command Console. To be able to do that, it needs to be accessed and the article titled ‘MySQL Database Access from Command Line in Linux‘ is written to show how to do it.¬†Below is the real example of the execution :
[user@hostname ~]$ mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 122
Server version: 5.1.71 Source distribution

Copyright (c) 2000, 2013, 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. 


By accessing MySQL Command Console, the information about the version itself can also be retrieved. Based on the output above, the version is 5.1.71.

One thought on “Check MySQL Version in Linux via Command Line

Leave a Reply