Checking the version of MySQL installed on a system helps users verify the system's compatibility with specific MySQL features. The MySQL version also determines whether the database can communicate with some third-party tools and plugins.
This article shows you how to check the MySQL version installed on your macOS system.
- A computer running macOS.
- MySQL installed.
How to Check MySQL Version on macOS
The steps to find the MySQL version on macOS depend on how MySQL was installed. The first five methods described in this tutorial can be applied to all installation types, while the last (GUI) method is exclusive to the DMG installer.
Find all six methods in the sections below and choose the one that suits your workflow.
Method 1: mysql Command
Every MySQL instance on macOS comes with the command-line interface preinstalled. Follow the steps below to check the MySQL version via CLI:
1. Open Finder and select Applications.
2. Expand the Utilities folder and select Terminal.
3. Type the following command:
The output shows the installed MySQL version.
If you receive an error, the path to the mysql binary may not have been added to the system's PATH variable during the MySQL installation. In this case, follow the procedure below to run the mysql command:
1. Go to MySQL's bin directory:
2. Type the following command:
The version number is printed in the output.
Note: Learn how to add a binary path to the PATH variable by reading How to Set Environment Variables in macOS.
Method 2: Console Login
The installed MySQL version is also visible in the welcome message printed out when the user logs in to MySQL using the terminal. Below is the command for logging in:
mysql -u [username]
For example, to log in as the root user, type:
mysql -u root
The command shows the MySQL version number in the Server version field.
Note: The next three methods in the sections below show MySQL version information using the MySQL statements issued from the database prompt. To apply these methods, log in to your MySQL instance first.
Method 3: STATUS Statement
The STATUS statement is a MySQL command that shows the system status, part of which is the version information. Type the command below to output the status message:
Find the version number in the Server version field.
Method 4: SELECT Statement
The SELECT statement extracts data from a database. Use it to print out the MySQL version number by typing:
SELECT VERSION ();
The command outputs the data in a result table.
Method 5: SHOW Statement
MySQL stores version information as a variable you can access using the SHOW statement. Enter the following command to print the version variable:
SHOW VARIABLES LIKE '%version';
Look for the version field in the table.
Method 6: GUI
Lastly, if you installed MySQL using a native macOS DMG installer from the official website, follow the steps below to check the MySQL version via GUI:
1. Open Finder and select the Applications item in the sidebar on the left side of the window.
2. Select System Settings from the list of applications.
3. Scroll through the sidebar content on the left side of the window until you find the MySQL item. Select MySQL.
4. Find the version number in the Instances section of the MySQL pane.
This tutorial provided six methods to check the MySQL version installed on your macOS system. The methods included GUI, CLI, and the procedures involving MySQL statements.
Next, check out our downloadable MySQL Command Cheat Sheet and save it for future reference.