
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Whoami Function or Command in MySQL Like Unix
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)
Advertisements