If MySQL is not installed, you can check the available versions in the Ubuntu repositories using the following commands:
sudo apt-cache policy mysql
and if MySql is installed already then you can run below command to check the version:
sudo mysql --version
Additionally, you can use the apt list command to list the available versions of MySQL packages:
sudo apt list -a | grep mysql
To check version of any package which is not yet installed on your ubuntu machine, just use below command:
sudo apt-cache policy package-name