Determine version locally / with access
select version();
or
mysql -V
Determine version remotely
nmap -sV -p 3306 addressOfMachine
or
nc -w 1 addressOfMachine 3306
With netcat you may see weird output, example is below
nc -w 1 192.168.1.1 3306
4
4.1.20�{
jWU$PHXc,fV[J=3'hW]NL
4
4.1.20�{
jWU$PHXc,fV[J=3'hW]NL
In this case the version is 4.1.20, so you’ll have to read through the mess that is netcat output.