The quickest way to find your MySQL version
Open a terminal or command prompt on your computer and type mysql --version, then press Enter. MySQL will print a single line showing the version number — something like "mysql Ver 8.0.32 for Linux on x86_64". That number after "Ver" is what you need.
If that command does not work, MySQL either is not installed on your computer or is not set up so your terminal can find it. The sections below cover what to do in that case, and how to check the version if you are connecting to MySQL on a different computer (like a web server).
Key Takeaways
- The command mysql --version shows your MySQL version in one line from your terminal or command prompt.
- If the command does not work, MySQL may not be installed, or your system does not know where to find it.
- If MySQL is running on a web server or another computer, you can log in and run SELECT VERSION(); to see the version.
- Different operating systems (Windows, Mac, Linux) use the same commands, but you may need to navigate to the MySQL folder first on Windows.
Checking the version from your terminal or command prompt
The mysql --version command works on Windows, Mac, and Linux. Open your terminal (Mac and Linux) or Command Prompt (Windows) and type the command exactly as shown. You do not need to be logged into MySQL — this command just checks what is installed on your computer.
On Windows, if you get an error saying the command is not found, you may need to navigate to the folder where MySQL is installed first. This is usually something like C:\Program Files\MySQL\MySQL Server 8.0\bin. Type cd C:\Program Files\MySQL\MySQL Server 8.0\bin (or whatever your path is), press Enter, then try the mysql --version command again.
Checking the version when you are logged into MySQL
If you are already connected to a MySQL database, you can check the version without closing the connection. Type SELECT VERSION(); and press Enter. MySQL will return the version number in a table format.
This method is useful when you are working on a web server or a shared hosting account where you connect to MySQL through a web interface or SSH. You do not need to know where MySQL is installed — you just need an active connection.
Checking the version on a web server or hosting account
If your website runs on a hosting provider (like GoDaddy, Bluehost, or a dedicated server), you usually cannot run commands from your own computer. Instead, log into your hosting control panel — this might be cPanel, Plesk, or your provider's custom dashboard — and look for a section called "MySQL" or "Databases".
Many hosting panels show the MySQL version right on the main database page. If not, you can create a small PHP file to check it. Create a file called version.php with this single line inside: <?php echo mysql_get_server_info(); ?> Upload it to your website, visit it in your browser, and it will display the version. Delete the file afterward for security.
Why the version number matters
MySQL version numbers tell you what features are available and what security updates you have. A version like 5.7 is older and no longer receives updates. Version 8.0 is current and receives regular security patches. If you are running an old version, your hosting provider or system administrator may recommend upgrading.
Knowing your version also helps when you search for help online. If you have a problem with MySQL, telling someone "I am running version 8.0.32" is much more useful than "my database is broken" — they can tell you whether the problem is known in that version and what the fix is.
What to do if the command does not work
If mysql --version returns "command not found" or "is not recognized", MySQL is either not installed or your system does not know where to find it. On Mac, you can install MySQL using Homebrew by typing brew install mysql. On Windows, read the installer from mysql.com and run it. On Linux, use your package manager — for Ubuntu or Debian, type sudo apt-get install mysql-server.
If you believe MySQL is installed but the command still does not work, the issue is usually that the MySQL folder is not in your system's PATH (the list of places your terminal looks for programs). On Mac and Linux, you can try typing the full path: /usr/local/mysql/bin/mysql --version. On Windows, navigate to the MySQL bin folder as described in the terminal section above.
Frequently Asked Questions
Does the version number format always look the same?
Version numbers follow the pattern X.Y.Z — like 8.0.32 or 5.7.40. The first number (8 or 5) is the major version and shows big changes. The second number (0 or 7) is the minor version. The third number (32 or 40) is the patch version and usually just means security fixes. All three together tell you exactly what you are running.
Can I have multiple versions of MySQL installed at the same time?
Yes, but it is not common and can cause confusion. If you have multiple versions, mysql --version will show whichever one your system finds first. If you need to use a specific version, you may need to use the full path to that version's folder or configure which one starts by default.
What if I see a version number that looks different, like MariaDB?
MariaDB is a separate database system that is compatible with MySQL but is not MySQL itself. If you see "MariaDB" in the version output, you are running MariaDB, not MySQL. The commands and features are almost identical, but they are different products. Check with your hosting provider or system administrator to confirm which one you need.
Is there a way to check the version without using the command line?
On Windows, you can open MySQL Workbench (a graphical tool) and it will show the version in the connection details. On Mac and Linux, most graphical tools also display the version somewhere in their interface. However, the command line is the fastest and most reliable method across all systems.