Reputation: 6364
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?
Upvotes: 14
Views: 10395
Reputation: 17418
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.
Upvotes: 0