Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
Is there a way to know your current username in MySQL?
Yes, you can use the method CURRENT_USER() to know the current username in MySQL.
The above method returns the username that can be used to authenticate the client connection.
The query is as follows −
mysql> select CURRENT_USER();
The following is the output −
+----------------+ | CURRENT_USER() | +----------------+ | root@% | +----------------+ 1 row in set (0.00 sec)
Or you can use USER() method from MySQL. The query is as follows −
mysql> select user();
Here is the output −
+----------------+ | user() | +----------------+ | root@localhost | +----------------+ 1 row in set (0.00 sec)
Advertisements
