| by Arround The Web | No comments

How to Check MySQL Version Using Windows Terminal?

Sometimes, users encounter situations where they need to know the current MySQL version. Likewise, it can be possible that particular features may not be compatible with their system, or you want to upgrade the current system to new features and better capability for their system. In such a situation, verification of the installed MySQL version.

This post will discuss the different ways to check the MySQL version using a Windows terminal.

How to Check MySQL Version Using Windows Terminal?

To check the MySQL version using the Windows terminal named “Command Prompt”, there are multiple statements and commands that are used for these corresponding purposes. These statements are listed below:

Let’s have a look at all of them one by one!

Method 1: Check MySQL Version Using the “SELECT VERSION” Statement

The “SELECT” command can be used along with the “@@version” variable or the “version()” function to show the current status of MySQL. To do so, follow the provided steps.

Step 1: Redirect to Windows Terminal

At first, switch to the “Command Prompt” by searching from the Startup menu:

Step 2: Connect With MySQL Database

Run the following command to log in and connect with your MySQL server locally:

mysql -u root -p

In the above-stated command:

  • -u” option denotes the user.
  • root” is the default username provided while installing MySQL.
  • -p” option represents the password.

As a result, you will be asked to enter the user password:

Step 3: Run the “SELECT” Command

Now, execute the “SELECT” command with the “version()” function to view the current version of our MySQL database:

SELECT version();

According to the following output, our MySQL database has an “8.0.32” version:

We can also replace the “version()” with the “@@version” variable for checking the current version of our MySQL database:

SELECT @@version;

Method 2: Check MySQL Version Using “SHOW VARIABLES LIKE” Statement

Another way to display the information about the MySQL version is by executing the “SHOW GLOBAL VARIABLES LIKE ‘<%variable-name%>’” statement:

SHOW GLOBAL VARIABLES LIKE '%version%';

Here:

  • SHOW” command is a special query used to display the schema’s information of desired records saved on the database.
  • GLOBAL VARIABLES” statement is used to view the global system variable values.
  • LIKE ‘<%variable-name%>’” clause indicates which variable names need to match.

When the above-stated statement is executed, all variables having names starting with “version” are displayed:

Method 3: Check MySQL Version Using “STATUS” Command

The “STATUS” command can be used to get the current MySQL database version. When it is executed, the relevant output displays the uptime information along with the detail about how long the MySQL server has been executing, threads details, and other useful information

STATUS;

That’s it! You have learned different methods for checking the MySQL version using the Windows terminal.

Conclusion

To check the MySQL version by utilizing the Windows terminal, different commands and statements are used, such as the “SELECT VERSION” statement, the “SHOW VARIABLES LIKE” statement, and the “STATUS” command. The “SHOW VARIABLES LIKE” statement will display the particular variable values. The output of the “STATUS” command contains uptime information and details about how long the MySQL server has been executing, thread details, and other useful details. This post described the methods of checking the MySQL version using a Windows terminal.

Share Button

Source: linuxhint.com

Leave a Reply