Several answers suggest using mysql --version. However, the mysql program is the client. The server is mysqld. Hence the command should be:
mysqld
That worked for me on Windows and Debian.
mysqld
While connected to the MySQL server with a client you can use.
select version()
or
select @@version
Want to become a SQL Expertise? Register to this SQL Course and get certified.