Get MySQL version using PHP
Many web based applications need to know what version of MySQL they are using. Fortunately MySQL has a built in command that will return the version as part of a query. Just enter the following command at the MySQL prompt and the server will return the version.

If you’re needing to get the version from inside a PHP script you can use the following code after connecting to the database server.
PHP:
Of course you can have $row[0] set to any variable you want to use rather than just echoing it back.
Question, Comments...
Do you have more questions. Please either leave a comment below or join us in our new forum.