mySQL 上的 mysql.user 表

vie*_*one 5 mysql account macos root

我在 Mac OS 上使用 mySQL。我通过命令登录mySQL

mysql - 你根

然后运行下面的命令

从 mysql.user 中选择用户;

它显示了下表

+---------+
| User    |
+---------+
| root    |
| root    |
|         |
| root    |
|         |
| gerrit2 |
| root    |
+---------+
7 rows in set (0.08 sec)
Run Code Online (Sandbox Code Playgroud)

我不明白有 4 行有根,2 行没有名字。请解释一下。谢谢!

Eug*_*eck 4

mysql.users 中的行定义部分是 (host,user) 元组 - 这意味着:

  • 您无需用户名即可拥有权限,具体取决于您从哪个主机连接
  • 您可以使用相同的用户名拥有不同的权限,这同样取决于主机