How to Check the MySQL Version
If you have found yourself having to work with a MySQL database that was setup by someone else then you might be wondering how to check the MySQL version. You might not be able to tell from the path or you may just be looking for a quick way to check this across multiple instances on multiple hosts.
The first command that you might want to try is this:
You can abbreviate this as:
That will give you the version of the server. Note that in the command above we used the command “mysqld” instead of “mysql”. This way we are directly checking from the server binary. You can also get the version from the client like this:
This also works and should be fine in most cases. Chances are both of these commands will be associated with the same MySQL installation. It is worth noting though that the client version and server version could be different.
You can also use this command:
You could also use any of these commands from the MySQL CLI. This can be especially useful if you are able to login remotely to the CLI but don’t have SSH access to the server that is hosting your database.
select version(); select @@version; SHOW VARIABLES LIKE "%version%";
Another alternative, if you are on a Debian or Ubuntu based system would be to use the following command which will tell you the version of the package:
dpkg -l 'mysql-server*'
On a Red Hat based system you could run the following to get the version of the package:
rpm -qa | grep -i mysql
You should be able to use the following on Arch Linux but might need to adjust it:
pacman -Qs mysql
If you are running Windows you might want to try something like this:
Video - Check the MySQL Version
Here is a video covering most of what I’ve shown on this page.
How do I know if I have MySQL enterprise?
To find out whether you are using MySQL enterprise or community edition you can just launch the MySQL CLI and observe the banner. It will tell you which edition you are using.
Once logged into the CLI you can also use the following command:
SHOW VARIABLES LIKE "%version%";