In order to determine which MySQL version you’re running you can type the following command:
# mysql -V mysql Ver 14.7 Distrib 4.1.11, for pc-linux-gnu (i386)
# mysql -V mysql Ver 14.12 Distrib 5.0.32, for pc-linux-gnu (i486) using readline 5.2
Now, if you want to query for the version number while beign logged in (PHP script for example), just go with:
SELECT VERSION(); .
I believe this is only working since MySQL 4 though.
Comments from long ago:
Comment from: Andrew
For all versions of mysql if you do SHOW VARIABLES; you will see the version in the list returned regardless of the version of mysql used.
Comment from: ryan
SELECT VERSION(); will work on mysql 3.23
Comment from: shahryar ghazi
i guess u r only printing the client’s version no. thru mysql -v