As a web developer or database administrator, knowing the version of MySQL you’re working with is crucial for ensuring compatibility with your applications, understanding the features available, and planning for upgrades. In this quick guide, I’ll show you how to view the MySQL version using several different methods.

1. Using the MySQL Command Line

If you have access to the MySQL command line, the easiest way to check the version is by logging in and running a simple command. Here’s how:

  1. Open your terminal or command prompt.
  2. Log in to MySQL by typing mysql -u username -p and entering your password when prompted. Replace username with your actual MySQL username.
  3. Once you’re logged in, type SELECT VERSION(); or SELECT @@VERSION; and press Enter.

MySQL will display the version number, something like this:

1
2
3
4
5
+-----------+  
| VERSION() |
+-----------+
| 8.0.27 |
+-----------+

2. Using the MySQL Client Command

Another quick way to check the MySQL version from the command line is to use the --version option with the mysql command without logging in. Here’s how:

  1. Open your terminal or command prompt.
  2. Type mysql --version and press Enter.

MySQL will display the version number along with some additional information, such as the build number and the distribution. Something like this:

1
mysql  Ver 14.14 Distrib 5.7.37, for Linux (x86_64) using  EditLine wrapper

3. Checking the Version in Your Database Tools

If you’re using database tools(e.g., PHPMyAdmin, DBeaver) to manage your MySQL databases, you can easily check the version by looking at the main page after logging in.
For example, if you have phpMyAdmin installed and prefer a graphical interface:

  • Open phpMyAdmin in your web browser.
  • Select the database server you want to check (if you have multiple servers).
  • Look for the MySQL version information typically displayed near the bottom of the page, in the “Server” section.

It should show you the MySQL server version prominently.
When using DBeaver, hovering over a connected database connection will display a floating window showcasing the database instance’s version alongside its name, URL, and the connected user’s username.

Conclusion

Checking the MySQL version is a straightforward process that can be done in several different ways. From the MySQL command line to popular database tools like PHPMyAdmin and DBeaver, there’s always a suitable method at hand. Knowing the version of MySQL you’re working with is an important step in ensuring the smooth operation of your database and applications.