To get information about the currently connected user and more MySQL status information, you can call the following command if you are already logged in:
mysql> STATUS;
This will give you an output like that:
-------------- mysql Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1 Connection id: 1044395 Current database: Current user: niceguy@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 5.1.73-log Source distribution Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: latin1 Db characterset: latin1 Client characterset: latin1 Conn. characterset: latin1 UNIX socket: /var/lib/mysql/mysql.sock Uptime: 2 days 6 hours 26 min 44 sec Threads: 8 Questions: 399680642 Slow queries: 20292 Opens: 9697 Flush tables: 1 Open tables: 4096 Queries per second avg: 2039.145 --------------
As you can see, you got a lot more information like operation system data, MysSQL version or the number of slow queries.
If you’re only interested in the current versions, you can also use the following command as well:
mysql> SHOW VARIABLES LIKE "%version%";
You’ll get something like that:
+-----------------------------------+------------------------------------------+
| Variable_name | Value |
+-----------------------------------+------------------------------------------+
| in_predicate_conversion_threshold | 1000 |
| innodb_version | 10.5.19 |
| protocol_version | 10 |
| slave_type_conversions | |
| system_versioning_alter_history | ERROR |
| system_versioning_asof | DEFAULT |
| tls_version | TLSv1.1,TLSv1.2,TLSv1.3 |
| version | 10.5.19-MariaDB-0+deb11u2 |
| version_comment | Debian 11 |
| version_compile_machine | x86_64 |
| version_compile_os | debian-linux-gnu |
| version_malloc_library | system |
| version_source_revision | f8a85af8ca1c937b8d4f847477bd282f80251cde |
| version_ssl_library | OpenSSL 1.1.1n 15 Mar 2022 |
| wsrep_patch_version | wsrep_26.22 |
+-----------------------------------+------------------------------------------+
15 rows in set (0.011 sec)