MySQL USER() and CURRENT_USER() Functions
Checking connected client username, authenticated host, active database, and server version.
SELECT
USER() AS connected_client,
CURRENT_USER() AS authenticated_account,
DATABASE() AS current_db,
VERSION() AS mysql_ver;+------------------+-----------------------+------------+-----------+ | connected_client | authenticated_account | current_db | mysql_ver | +------------------+-----------------------+------------+-----------+ | root@localhost | root@localhost | company_db | 8.0.36 | +------------------+-----------------------+------------+-----------+ 1 row in set (0.00 sec)