14

I already know this command in Linux

mysql --version #outputs version of MySQL

But I have a case where I can't get access to the server, but can connect to the db.

Is there a MYSQL query which will output its own version?

1
  • 2
    something like show variables like '%version%'
    – Drew
    Aug 11, 2015 at 18:47

2 Answers 2

22

From the Manual

show variables like '%version%';
2
  • the answer being correct, you should mark it so other people looking this up in the future know...
    – BK435
    Aug 11, 2015 at 19:48
  • 5
    Or SELECT @@VERSION;. Aug 11, 2015 at 23:28
0

Example: Unix command(root is the MYSQL username),

$ mysql -u root -p -e 'SHOW VARIABLES LIKE "%version%";'

Sample outputs:

+-------------------------+-------------------------+
| Variable_name           | Value                   |
+-------------------------+-------------------------+
| innodb_version          | 5.5.49                  |
| protocol_version        | 10                      |
| slave_type_conversions  |                         |
| version                 | 5.5.49-0ubuntu0.14.04.1 |
| version_comment         | (Ubuntu)                |
| version_compile_machine | x86_64                  |
| version_compile_os      | debian-linux-gnu        |
+-------------------------+-------------------------+

In above case mysql version is 5.5.49.

Please find this useful reference.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.