Introduction
Knowing the version of MySQL you are running can be important for compatibility, troubleshooting, and updating. This tutorial will guide you through the different ways to check your MySQL version on Windows, macOS, and Ubuntu systems. Whether you are a beginner or an advanced user, you’ll find a method that suits your skill level.
Checking the MySQL Version in Windows
Using Command Prompt
C:\> mysql --version
This command will output the version information of your MySQL installation. An example of the output is:
mysql Ver 15.1 Distrib 10.2.14-MariaDB, for Win64 (x86_64)
Using MySQL Command-Line Client
- Open MySQL Command-Line Client from the Start menu. You might need to enter your MySQL root password.
- Type the following query and hit enter:
SELECT VERSION();
The version of MySQL will be displayed in the result set.
Checking the MySQL Version on macOS
Using Terminal
Open Terminal and type:
$ mysql --version
The output will look something like this:
mysql Ver 14.14 Distrib 5.7.21, for osx10.13 (x86_64) using EditLine wrapper
Using MySQL Workbench
MySQL Workbench provides a graphical interface for MySQL services. You can find the version by:
- Opening MySQL Workbench.
- Connecting to your MySQL instance.
- Navigating to ‘Server Status’ under the ‘Management’ section in the sidebar.
- The MySQL version is displayed in the ‘Server Information’ area.
Checking the MySQL Version on Ubuntu
Using Terminal
Type the following command into your terminal:
$ mysql --version
The output will display the installed MySQL version:
mysql Ver 15.1 Distrib 10.1.31-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
Advanced: MySQL Version from the MySQL Prompt
You can also get detailed MySQL version information from within the MySQL shell:
$ mysql -u root -p
mysql> STATUS;
This will present a block of server status information including the version and more.
Using the APT Package Manager
If you installed MySQL through the APT package manager, you can also check the version by running:
$ dpkg -l | grep mysql-server
This will list the installed MySQL server packages along with versions.
Conclusion
Regardless of your operating system, there are several quick and reliable methods to check which MySQL version your server is running. Knowing your MySQL version helps maintain system compatibility and aids in targeted troubleshooting.