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