In this quick tutorial, we'll learn how to check the MySQL version of a server. Without a doubt, MySQL is one of the most popular RDBMS [Relational database management system] options available, so you'll find it pretty much everywhere. There can be some pretty staggering differences between MySQL versions, so knowing which version you're working with is important. Learn here how to check the version of MySQL your server is using!
Let's start with a quick video review of this
subject:
Check the MySQL version
- These instructions are intended for checking the MySQL [or MariaDB] version on our VPS server [and are similar to the dedicated server directions as well].
- We'll be working from our high-availability MySQL server, and I'll be logged in as root.
From the Command Line
- With a command line open, enter the following command:
subject
mysql -V
mysql Ver 15.1 Distrib 10.1.29-MariaDB, for Linux [x86_64] using readline 5.1
Note:
Are you looking to upgrade MySQL on a Liquid Web Core Managed or Fully Managed server? Then contact our support team! If you’re looking for ways to improve the performance of your VPS, check out our blog on Optimizing Your VPS!
From the MySQL Client
1. When you run the MySQL command client without any flags the version will be displayed. So while logged in via SSH enter:
mysql
Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 4 Server version: 10.1.29-MariaDB MariaDB Server
Copyright [c] 2000, 2017, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help.
Type '\c' to clear the current input statement.
The server version in this example is 10.1.29-MariaDB MariaDB Server.
2. From within the MySQL client, you can also run the following command for more details:
SHOW VARIABLES LIKE "%version%";
+-------------------------+----------------------------+
| Variable_name | Value |
+-------------------------+----------------------------+
| innodb_version | 5.6.36-82.2 |
| protocol_version | 10 |
| slave_type_conversions | |
| version | 10.1.29-MariaDB |
| version_comment | MariaDB Server |
| version_compile_machine | x86_64 |
| version_compile_os | Linux |
| version_malloc_library | system |
| version_ssl_library | OpenSSL 1.1.0g 2 Nov 2017 |
| wsrep_patch_version | wsrep_25.21 |
+-------------------------+----------------------------+
10 rows in set [0.02 sec]
In this block of text, you'll find additional version details about your installed MySQL software like innodb_version, protocol_version, version_ssl_library, and more.
From The PHPMyAdmin Interface
If you aren't familiar with running commands through ssh, you may have access to PHPMyAdmin on the server which gives a nice graphical interface for managing the databases. If you have cPanel or Plesk access you should be able to open PHPMyAdmin when logged in to the hosting account. In PHPMyAdmin on the right side, it should have information listen under the "Database server" section and the "Server version" is what shows the MySQL or MariaDB version is running on the server.
When standard uptime is not enough, you don’t have to wage war alone. Liquid Web's High-Availability Databases provides the bleeding edge hardware needed for keeping your site online. Does significantly reducing overhead while not having to worry about managing MySQL sounds like a dream come true? Then check out our affordable plans!
What command returns the current version of a MySQL database?
asked Jan 24, 2012 at 13:33
1
Try this function -
SELECT VERSION[];
-> '5.7.22-standard'
VERSION[]
Or for more details use :
SHOW VARIABLES LIKE "%version%";
+-------------------------+------------------------------------------+
| Variable_name | Value |
+-------------------------+------------------------------------------+
| protocol_version | 10 |
| version | 5.0.27-standard |
| version_comment | MySQL Community Edition - Standard [GPL] |
| version_compile_machine | i686 |
| version_compile_os | pc-linux-gnu |
+-------------------------+------------------------------------------+
5 rows in set [0.04 sec]
MySQL 5.0 Reference Manual [pdf] - Determining Your Current MySQL Version - page 42
Nolwennig
1,55323 silver badges29 bronze badges
answered Jan 24, 2012 at 13:35
DevartDevart
116k22 gold badges161 silver badges181 bronze badges
4
Many answers suggest to use mysql --version
. But the mysql
programm is the client. The server is mysqld
. So the command should be
mysqld --version
or
mysqld --help
That works for me on Debian and Windows.
When connected to a MySQL server with a client you can use
select version[]
or
select @@version
answered Mar 7, 2019 at 13:46
Paul SpiegelPaul Spiegel
30k5 gold badges42 silver badges51 bronze badges
try
mysql --version
for instance. Or dpkg -l 'mysql-server*'
.
answered Jan 24, 2012 at 13:35
9
Use mysql -V
works fine for me on Ubuntu.
Nolwennig
1,55323 silver badges29 bronze badges
answered Jun 6, 2016 at 1:57
Umesh KaushikUmesh Kaushik
1,4891 gold badge16 silver badges18 bronze badges
1
Mysql Client version : Please beware this doesn't returns server version, this gives mysql client utility version
mysql -version
Mysql server version : There are many ways to find
SELECT version[];
SHOW VARIABLES LIKE "%version%";
mysqld --version
answered Aug 31, 2018 at 9:34
Amitesh BhartiAmitesh Bharti
11.7k6 gold badges57 silver badges54 bronze badges
3
SHOW VARIABLES LIKE "%version%";
+-------------------------+------------------------------------------+
| Variable_name | Value |
+-------------------------+------------------------------------------+
| protocol_version | 10 |
| version | 5.0.27-standard |
| version_comment | MySQL Community Edition - Standard [GPL] |
| version_compile_machine | i686 |
| version_compile_os | pc-linux-gnu |
+-------------------------+------------------------------------------+
5 rows in set [0.04 sec]
MySQL 5.0 Reference Manual [pdf] - Determining Your Current MySQL Version - page 42
Nolwennig
1,55323 silver badges29 bronze badges
answered Jan 24, 2012 at 13:37
John WooJohn Woo
252k68 gold badges491 silver badges486 bronze badges
0
Go to MySQL workbench and log to the server. There is a field called Server Status under MANAGEMENT. Click on Server Status and find out the version.
Or else go to following location and open cmd -> C:\Windows\System32\cmd.exe. Then hit the command -> mysql -V
answered Nov 3, 2020 at 10:59
1
Simply login to the Mysql with
mysql -u root -p
Then type in this command
select @@version;
This will give the result as,
+-------------------------+
| @@version |
+-------------------------+
| 5.7.16-0ubuntu0.16.04.1 |
+-------------------------+
1 row in set [0.00 sec]
answered Dec 28, 2016 at 6:13
I found a easy way to get that.
Example: Unix command[this way you don't need 2 commands.],
$ mysql -u root -p -e 'SHOW VARIABLES LIKE "%version%";'
Sample outputs:
+-------------------------+-------------------------+
| Variable_name | Value |
+-------------------------+-------------------------+
| innodb_version | 5.5.49 |
| protocol_version | 10 |
| slave_type_conversions | |
| version | 5.5.49-0ubuntu0.14.04.1 |
| version_comment | [Ubuntu] |
| version_compile_machine | x86_64 |
| version_compile_os | debian-linux-gnu |
+-------------------------+-------------------------+
In above case mysql version is 5.5.49.
Please find this useful reference.
answered Jun 30, 2016 at 7:18
tk_tk_
15.2k8 gold badges77 silver badges88 bronze badges
For UBUNTU you can try the following command to check mysql version :
mysql --version
Denim Datta
3,7103 gold badges26 silver badges53 bronze badges
answered Dec 5, 2013 at 8:30
2
MySQL Server version
shell> mysqld --version
MySQL Client version
shell> mysql --version
shell> mysql -V
answered Jan 13, 2014 at 7:20
Nanhe KumarNanhe Kumar
14.7k3 gold badges75 silver badges69 bronze badges
2
mysqladmin version
OR mysqladmin -V
ptierno
9,0202 gold badges22 silver badges35 bronze badges
answered Oct 28, 2014 at 7:22
Singh AnujSingh Anuj
991 silver badge1 bronze badge
2
From the console you can try:
mysqladmin version -u USER -p PASSWD
GDP
7,9336 gold badges43 silver badges79 bronze badges
answered Jan 24, 2012 at 13:37
spikespike
894 bronze badges
With CLI in one line :
mysql --user=root --password=pass --host=localhost db_name --execute='select version[]';
or
mysql -uroot -ppass -hlocalhost db_name -e 'select version[]';
return something like this :
+-----------+
| version[] |
+-----------+
| 5.6.34 |
+-----------+
answered Apr 11, 2017 at 14:39
NolwennigNolwennig
1,55323 silver badges29 bronze badges
For Mac,
login to mysql server.
execute the following command:
SHOW VARIABLES LIKE "%version%";
answered Aug 9, 2018 at 7:39
KayVKayV
12k10 gold badges92 silver badges131 bronze badges
2
You can also look at the top of the MySQL shell when you first log in. It actually shows the version right there.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 67971
Server version: 5.1.73 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.
mysql>
answered Dec 23, 2016 at 20:24
E:\>mysql -u root -p
Enter password: *******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1026
Server version: 5.6.34-log MySQL Community Server [GPL]
Copyright [c] 2000, 2016, 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.
mysql> select @@version;
+------------+
| @@version |
+------------+
| 5.6.34-log |
+------------+
1 row in set [0.00 sec]
Marco Bonelli
58.5k20 gold badges112 silver badges117 bronze badges
answered Apr 19, 2017 at 10:12
2
Xampp with Windows users below in the command whihc worked in the mysql directory.
answered Apr 19, 2021 at 6:50
In windows ,open Command Prompt and type MySQL -V
or MySQL --version
. If you use Linux get terminal and type MySQL -v
answered Aug 18, 2018 at 15:23
2
Sometimes it is important to know which version of MySQL candidate is available to installed by default. here is the little command to check that prior to actually installing.
sudo apt-cache policy mysql-server
This is more important for any existing project which might be running on old MySQL Versions e.g. 5.7.
A sample output of the above command could be:
mysql-server: Installed: [none] Candidate: 8.0.29-0ubuntu0.20.04.3 Version table: 8.0.29-0ubuntu0.20.04.3 500
500 //mirrors.digitalocean.com/ubuntu focal-updates/main amd64 Packages 500 //security.ubuntu.com/ubuntu focal-security/main amd64 Packages 8.0.19-0ubuntu5 500
500 //mirrors.digitalocean.com/ubuntu focal/main amd64 Packages
This states that by default by running the following command some flavour of MySQL Server 8 will be installed.
sudo apt install mysql-server
answered May 7 at 20:52
Print a Dockerized MariaDB/MySQL Server version:
When I backup a WordPress site- in this case containerized- I capture the WordPress version in the filename as well as the DB version that was current at the time of the backup. This ensures that if I ever needed to restore, I wouldn't have a compatibility nightmare figuring out what version DB works with a specified version of the WordPress backup.
So I include the DB server version in the dump name. I loaded the below into a self-populating variable:
docker exec -it ContainerIdOfDB mysqld --version | awk '{print $3}' | cut -d'-' -f1
This pukes out the current DB version without having to login to retrieve it.
answered Jul 28 at 0:10
F1LinuxF1Linux
2,6663 gold badges16 silver badges18 bronze badges
Here two more methods:
Linux: Mysql view version: from PHP
From a PHP function, we can see the version used:
mysql_get_server_info [[resource $ link_identifier = NULL]]: string
Linux: Mysql view version: Package version
For RedHat / CentOS operating systems:
rpm -qa | grep mysql
For Debian / Ubuntu operating systems:
rpm -qa | grep mysql
Extracted from: //www.sysadmit.com/2019/03/linux-mysql-ver-version.html
answered Mar 10, 2019 at 10:32
Only this code works for me
/usr/local/mysql/bin/mysql -V
answered Nov 16, 2019 at 4:25
KuhanKuhan
4767 silver badges16 bronze badges
1