There is no whoami function in MySQL. The whoami can be used to know the current user in UNIX. Use user() or current_user() function from MySQL for the same purpose.
The following is the output.
+-----------+ | version() | +-----------+ | 8.0.12 | +-----------+ 1 row in set (0.00 sec)
Case 1 −Using CURRENT_USER() function.
The query to know the current user is as follows.
mysql> select current_user();
The following is the output.
+----------------+ | current_user() | +----------------+ | root@% | +----------------+ 1 row in set (0.00 sec)
Case 2 − Using USER() function.
The query is as follows −
mysql> select user();
The following is the output.
+----------------+ | user() | +----------------+ | root@localhost | +----------------+ 1 row in set (0.00 sec)