mysql> select current_user();
+----------------+
| current_user() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.06 sec)
mysql> select current_user;
+----------------+
| current_user |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)
mysql> select user();
+----------------+
| user() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)
3种方式都可以
本文介绍了在MySQL中查询当前登录用户的三种方法,分别是使用select current_user();、select current_user;和select user();,这些方法可以帮助数据库管理员快速确认当前操作的用户身份。

946

被折叠的 条评论
为什么被折叠?



