意外发现USER()和CURRENT_USER()的一点不同。某次在用 ALTER USER 想要修改账户密码时,发现执行下面的SQL会报语法错误:
Returns the user name and host name combination for
the MySQL account that the server used to authenticate
the current client. This account determines your access
privileges. The return value is a string in the utf8
character set.
Returns the current MySQL user name and host name as简言之,CURRENT_USER() 返回的是当前用户所对应的授权账户,而 USER() 返回的是当前连接用户。这么说可能还有点疑惑,看下面的案例吧:
a string in the utf8 character set.
欢迎光临 ToB企服应用市场:ToB评测及商务社交产业平台 (https://dis.qidao123.com/) | Powered by Discuz! X3.4 |