User names and host names have certain special values or wildcard conventions, as described following. 

The user name part of an account name is either a nonblank value that literally matches the user name for incoming connection attempts, or a blank value (the empty string) that matches any user name. An account with a blank user name is an anonymous user. To specify an anonymous user in SQL statements, use a quoted empty user name part, such as ’’@’localhost’ . 

The host name part of an account name can take many forms, and wildcards are permitted: 

•A host value can be a host name or an IP address (IPv4 or IPv6). The name ’localhost’  indicates the local host. The IP address ’127.0.0.1’  indicates the IPv4 loopback interface. The IP address ’::1’ indicates the IPv6 loopback interface. 

•The %  and _  wildcard characters are permitted in host name or IP address values. These have the same meaning as for pattern-matching operations performed with the LIKE  operator. For example, a host value of ’%’  matches any host name, whereas a value of ’%.mysql.com’  matches any host in the mysql.com  domain. ’198.51.100.%’  matches any host in the 198.51.100 class C network. 

Because IP wildcard values are permitted in host values (for example, ’198.51.100.%’  to match every host on a subnet), someone could try to exploit this capability by naming a host 198.51.100.somewhere.com . To foil such attempts, MySQL does not perform matching on host names that start with digits and a dot. For example, if a host is named 1.2.example.com , its name never matches the host part of account names. An IP wildcard value can match only IP addresses, not host names. 

•For a host value specified as an IPv4 address, a netmask can be given to indicate how many address bits to use for the network number. Netmask notation cannot be used for IPv6 addresses. 

The syntax is host_ip / netmask . For example: 

CREATE USER ’david’@’198.51.100.0/255.255.255.0’; 

This enables david  to connect from any client host having an IP address client_ip  for which the following condition is true: 

client_ip  & netmask  = host_ip 

That is, for the CREATE USER  statement just shown: 

client_ip  & 255.255.255.0 = 198.51.100.0 

IP addresses that satisfy this condition range from 198.51.100.0  to 198.51.100.255 . 

A netmask typically begins with bits set to 1, followed by bits set to 0. Examples: 

• 198.0.0.0/255.0.0.0 : Any host on the 198 class A network 

• 198.51.0.0/255.255.0.0 : Any host on the 198.51 class B network 

• 198.51.100.0/255.255.255.0 : Any host on the 198.51.100 class C network 

• 198.51.100.1 : Only the host with this specific IP address 

•As of MySQL 8.0.23, a host value specified as an IPv4 address can be written using CIDR notation, such as 198.51.100.44/24 . 

The server performs matching of host values in account names against the client host using the value returned by the system DNS resolver for the client host name or IP address. Except in the case that the 

