开发者

Just the MySQL username please. Not the host

开发者 https://www.devze.com 2023-03-30 02:28 出处:网络
I\'m already aware of USER().How do I just get the username - i.e the stuff before 开发者_C百科@

I'm already aware of USER(). How do I just get the username - i.e the stuff before 开发者_C百科@

+------------------+
| USER()           |
+------------------+
| billy@localhost |
+------------------+

I want simple billy. This will be used in a TRIGGER.

Thanks


SELECT SUBSTRING_INDEX(USER(),'@',1);

See: Information Functions: USER()


from help:

SELECT SUBSTRING_INDEX(USER(),'@',1);
0

精彩评论

暂无评论...
验证码 换一张
取 消