Try:
mysql -e status|grep 'Server version'

If that doesn't work then use:
mysql -u root -p -e status|grep 'Server version'
Provide root password when prompted. Default root password for MySQL is empty string, so just pressing enter when prompted for password will suffice by default.

Windows users should simply run:
mysql -e status
or the equivalent with login specified and then look for Server version string in the output to find the version.