mysql提供了很多内部函数吗,其中查看用户的函数有四个,分别是:user()、system_user()、session_user()、current_user(),相信很多人见了他们都眼熟,或者已经用过他们,有木有感觉他们返回的值一直都是一样,他们有没有区别,如果有是什么区别了?
只能说我菜,在网上找了下没发现谁解释过他们四个的区别,那就只能自己来了,下面是通过mysql客户端查看到的帮助信息,直接贴解释吧.
user:Returns the current MySQL username and hostname as a string in the utf8 character set.//phpfensi.com
system_user:SYSTEM_USER() is a synonym for USER().
session_user:SESSION_USER() is a synonym for USER().
current_user:
Returns the username and hostname combination for the MySQL account that the server used to authenticate the current client. This account determines your access privileges. As of MySQL 5.0.10, within a stored routine that is defined with the SQL SECURITY DEFINER characteristic,CURRENT_USER() returns the creator of the routine. The return value is
a string in the utf8 character set.
The value of CURRENT_USER() can differ from the value of USER().
其实想翻一下再放出来的,怎奈自己那见不人的英语水平,就不翻译了,总的来说,user()、system_user()、session_user(),这三是同一个东西(synonym ),然后current_user()跟前三个也很像,不过他偶尔又会有点区别. |