MySQL includes the @@version system variable and the VERSION() function that enable you to find out what version of MySQL you’re running.
The VERSION() Function
Here’s an example of using the VERSION() function:
SELECT VERSION();
This simply returns the version number and no more. Like this:
8.0.11
The @@version System Variable
Here’s an example of using the @@version variable:
SELECT @@version;
This also returns only the version number. Like this:
8.0.11
The SHOW VARIABLES Command
You can also use the SHOW VARIABLES command to list out all system variables. This command outputs all system variables. But because there are a lot of system variables, you probably want to narrow the results with a LIKE clause.
Like this:
SHOW VARIABLES LIKE "%version%";
This results in something like this:
| Variable_name | Value |
|---|---|
| innodb_version | 8.0.11 |
| protocol_version | 10 |
| slave_type_conversions | |
| tls_version | TLSv1,TLSv1.1,TLSv1.2 |
| version | 8.0.11 |
| version_comment | MySQL Community Server – GPL |
| version_compile_machine | x86_64 |
| version_compile_os | macos10.13 |
| version_compile_zlib | 1.2.11 |