Identify MySQL version in MySQL Command Line Prompt


If you are in MySQL prompt and want to know which version of the database you are using, you can make use of below queries,

mysql> select version(); 

+-------------------------+
| version()               |
+-------------------------+
| 8.0.28-0ubuntu0.20.04.3 |
+-------------------------+

1 row in set (0.01 sec)

Know installed mysql version using queries

You can also find the details by looking at the variable name version

mysql> show variables like 'version';
+---------------+-------------------------+
| Variable_name | Value                   |
+---------------+-------------------------+
| version       | 8.0.28-0ubuntu0.20.04.3 |
+---------------+-------------------------+
1 row in set (0.01 sec)

One other way is to quit and come out of mysql prompt and once you login you will see the version details,

mysql> quit
Bye
root@b2391b608026:/# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 8.0.28-0ubuntu0.20.04.3 (Ubuntu)

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

mysql> 
Advertisements
Try Out Code2care Dev Tools:

Advertisements

Advertisements
Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.