The The MySQL Command-Line Client will show the version as soon as you successfully enter it:
admin@server:~$ sudo mysql -u admin -p
[sudo] password for admin:
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 70589
Server version: 5.7.27-0ubuntu0.16.04.1 (Ubuntu)
If you are already in the The MySQL Command-Line Client & scrolling up is not viable, you can just run a query:
mysql> SELECT VERSION();
+-------------------------+
| VERSION() |
+-------------------------+
| 5.7.27-0ubuntu0.16.04.1 |
+-------------------------+
1 row in set (0.01 sec)
If you just want to check from the shell directly:
admin@server:~$ mysqld --version
mysqld Ver 5.7.27-0ubuntu0.16.04.1 for Linux on x86_64 ((Ubuntu))
admin@server:~$ mysql --version
mysql Ver 14.14 Distrib 5.7.27, for Linux (x86_64) using EditLine wrapper
On Macs, the format is a little different, but the commands are the same:
admin@macbook$ mysqld --version
/usr/local/Cellar/mysql/8.0.19/bin/mysqld Ver 8.0.19 for osx10.15 on x86_64 (Homebrew)
admin@server$ mysql --version
mysql Ver 8.0.19 for osx10.15 on x86_64 (Homebrew)
Tested on: Ubuntu 16.04, MacOS Catalina