创建新的MySQL用户:主机匹配意味着什么?
我正在学习udemy的教程,我一直在设置一个新用户。我已经设法完成了它最好的部分,但是教程使用了phpmyadmin,现在我在工作台上创建新的MySQL用户:主机匹配意味着什么?,mysql,Mysql,我正在学习udemy的教程,我一直在设置一个新用户。我已经设法完成了它最好的部分,但是教程使用了phpmyadmin,现在我在工作台上 有人能解释一下“主机匹配限制”的用途吗?它是否只允许具有特定IP地址或域名的用户访问?我只是在一个本地服务器上运行,我可以使用root来完成这个项目,但是,嘿,我必须在某个阶段学习它,为什么现在不呢?严格来说,这不是一个MySQL工作台问题,但对于用户创建来说是必不可少的:主机部分可以是主机名(由MySQL解析为IP地址)或IP地址(IPv4或IPv6)。从运行
有人能解释一下“主机匹配限制”的用途吗?它是否只允许具有特定IP地址或域名的用户访问?我只是在一个本地服务器上运行,我可以使用root来完成这个项目,但是,嘿,我必须在某个阶段学习它,为什么现在不呢?严格来说,这不是一个MySQL工作台问题,但对于用户创建来说是必不可少的:主机部分可以是主机名(由MySQL解析为IP地址)或IP地址(IPv4或IPv6)。从运行MySQL服务器的主机上看,这些值确定用户可以从哪个主机连接(例如,
localhost
表示MySQL服务器机器,而不是您连接的机器,当然,除非它是同一个框)。对于每个变体,您可以使用通配符和占位符来匹配一系列机器
的此页介绍了匹配过程并显示了示例:
The following table shows how various combinations of User and Host values in the user table apply to incoming connections.
╔═════════════╦═══════════════════════════════╦═══════════════════════════════════════════════════════════════════════════════════════════════════════════╗
║ User Value ║ Host Value ║ Permissible Connections ║
╠═════════════╬═══════════════════════════════╬═══════════════════════════════════════════════════════════════════════════════════════════════════════════╣
║ 'fred' ║ 'h1.example.net' ║ fred, connecting from h1.example.net ║
║ '' ║ 'h1.example.net' ║ Any user, connecting from h1.example.net ║
║ 'fred' ║ '%' ║ fred, connecting from any host ║
║ '' ║ '%' ║ Any user, connecting from any host ║
║ 'fred' ║ '%.example.net' ║ fred, connecting from any host in the example.net domain ║
║ 'fred' ║ 'x.example.%' ║ fred, connecting from x.example.net, x.example.com, x.example.edu, and so on; this is probably not useful ║
║ 'fred' ║ '198.51.100.177' ║ fred, connecting from the host with IP address 198.51.100.177 ║
║ 'fred' ║ '198.51.100.%' ║ fred, connecting from any host in the 198.51.100 class C subnet ║
║ 'fred' ║ '198.51.100.0/255.255.255.0' ║ Same as previous example ║
╚═════════════╩═══════════════════════════════╩═══════════════════════════════════════════════════════════════════════════════════════════════════════════╝
严格说来,这不是MySQL工作台的问题,但对于用户创建来说是至关重要的:主机部分可以是主机名(由MySQL解析为IP地址)或IP地址(IPv4或IPv6)。从运行MySQL服务器的主机上看,这些值确定用户可以从哪个主机连接(例如,
localhost
表示MySQL服务器机器,而不是您连接的机器,当然,除非它是同一个框)。对于每个变体,您可以使用通配符和占位符来匹配一系列机器
的此页介绍了匹配过程并显示了示例:
The following table shows how various combinations of User and Host values in the user table apply to incoming connections.
╔═════════════╦═══════════════════════════════╦═══════════════════════════════════════════════════════════════════════════════════════════════════════════╗
║ User Value ║ Host Value ║ Permissible Connections ║
╠═════════════╬═══════════════════════════════╬═══════════════════════════════════════════════════════════════════════════════════════════════════════════╣
║ 'fred' ║ 'h1.example.net' ║ fred, connecting from h1.example.net ║
║ '' ║ 'h1.example.net' ║ Any user, connecting from h1.example.net ║
║ 'fred' ║ '%' ║ fred, connecting from any host ║
║ '' ║ '%' ║ Any user, connecting from any host ║
║ 'fred' ║ '%.example.net' ║ fred, connecting from any host in the example.net domain ║
║ 'fred' ║ 'x.example.%' ║ fred, connecting from x.example.net, x.example.com, x.example.edu, and so on; this is probably not useful ║
║ 'fred' ║ '198.51.100.177' ║ fred, connecting from the host with IP address 198.51.100.177 ║
║ 'fred' ║ '198.51.100.%' ║ fred, connecting from any host in the 198.51.100 class C subnet ║
║ 'fred' ║ '198.51.100.0/255.255.255.0' ║ Same as previous example ║
╚═════════════╩═══════════════════════════════╩═══════════════════════════════════════════════════════════════════════════════════════════════════════════╝
它限制对特定主机或主机模式的访问。通常您会将其设置为
%
或“任意主机”,但有时您会想将其锁定。在这种情况下,您可以定义单词host吗?它是一个ip地址还是一个web地址还是什么?不要仅仅因为使用了IDE就使用IDE标记,rhat包括MySQL工作台。问题在于MySQL本身。您是否考虑过查阅文档?“主机”是指(FQDN),或者换句话说,是与请求访问的主机对应的DNS名称。这是通过将任意IP转换为主机名(如果存在PTR
记录)来实现的。它限制对特定主机或主机模式的访问。通常您会将其设置为%
或“任意主机”,但有时您会想将其锁定。在这种情况下,您可以定义单词host吗?它是一个ip地址还是一个web地址还是什么?不要仅仅因为使用了IDE就使用IDE标记,rhat包括MySQL工作台。问题在于MySQL本身。您是否考虑过查阅文档?“主机”是指(FQDN),或者换句话说,是与请求访问的主机对应的DNS名称。这是通过将任意IP转换为主机名(如果存在PTR
记录)来实现的。