MySQL VERSION() Explained

In MySQL, VERSION() is a built-in function that returns the MySQL server version.

The result is a string that uses the utf8mb3 character set. A suffix may also be appended to the version number indicating server build or configuration information.

Syntax

The syntax goes like this:

VERSION()

No arguments are required, or accepted.

Example

Here’s an example to demonstrate:

SELECT VERSION();

Example result:

+-----------+
| VERSION() |
+-----------+
| 8.0.29    |
+-----------+

As mentioned, the result may also include a suffix indicating server build or configuration information. -debug indicates that the server was built with debugging support enabled.

No Arguments

The VERSION() function doesn’t accept any arguments. Passing an argument results in an error:

SELECT VERSION(1);

Result:

ERROR 1582 (42000): Incorrect parameter count in the call to native function 'VERSION'