欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

mysql用户函数区别

程序员文章站 2022-03-14 17:01:56
...

只能说我菜,在网上找了下没发现谁解释过他们四个的区别,那就只能自己来了。下面是通过mysql客户端查看到的帮助信息,直接贴解释吧。 user:Returns the current MySQL username and hostname as a string in the utf8 character set. system_user:SYSTEM_

  只能说我菜,在网上找了下没发现谁解释过他们四个的区别,,那就只能自己来了。下面是通过mysql客户端查看到的帮助信息,直接贴解释吧。

  user:Returns the current MySQL username and hostname as a string in the utf8 character set.

  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()跟前三个也很像,不过他偶尔又会有点区别。