Determining the Current MySQL User : USER « User Permission « SQL / MySQL






Determining the Current MySQL User

       
mysql>
mysql> SELECT SUBSTRING_INDEX(USER( ),'@',1);
+--------------------------------+
| SUBSTRING_INDEX(USER( ),'@',1) |
+--------------------------------+
| root                           |
+--------------------------------+
1 row in set (0.00 sec)

mysql> SELECT SUBSTRING_INDEX(USER( ),'@',-1);
+---------------------------------+
| SUBSTRING_INDEX(USER( ),'@',-1) |
+---------------------------------+
| localhost                       |
+---------------------------------+
1 row in set (0.00 sec)

mysql>

   
    
    
    
    
    
    
  








Related examples in the same category

1.USER() for current user
2.Create view for users
3.Execute a SELECT statement similar to the following to view how that user is listed in the user table
4.Use a SELECT statement to view information about that user account
5.Use SELECT statement to view the user account information that is added to the user table
6.Find the name of the current SQL user.
7.To delete the account instead
8.Allows logins only from the local network
9.Choose another name besides root