Access Control, Stage 1: Connection Verification •The pattern  ’%’  means “any host”  and is least specific. •The empty string  ’’  also means “any host”  but sorts after  ’%’ . The first row matches a connection by any user from  h1.example.net , whereas the second row matches a connection by  jeffrey  from any host. Here is another example. Suppose that the  user  table looks like this: When a client attempts to connect, the server looks through the sorted rows and uses the first match found. For a connection from  localhost  by  jeffrey , two of the rows from the table match: the one with Host  and  User  values of  ’localhost’  and  ’’ , and the one with values of  ’%’  and  ’jeffrey’ . The ’localhost’  row appears first in sorted order, so that is the one the server uses. When the server reads the table into memory, it sorts the rows using the rules just described. The result after sorting looks like this: To see how this works, suppose that the  user  table looks like this: For rows with equally-specific  Host  and  User  values, the order is nondeterministic. Rows with the same  Host  value are ordered with the most-specific  User  values first. A blank  User  value means “any user”  and is least specific, so for rows with the same  Host  value, nonanonymous users sort before anonymous users. Non-TCP (socket file, named pipe, and shared memory) connections are treated as local connections and match a host part of  localhost  if there are any such accounts, or host parts with wildcards that match localhost  otherwise (for example,  local% ,  l% ,  % ). 1219 +----------------+----------+- | Host | User | ... +----------------+----------+- | h1.example.net | | ... | % | jeffrey | ... +----------------+----------+- The sorted table looks like this: +----------------+----------+- | Host | User | ... +----------------+----------+- | % | jeffrey | ... | h1.example.net | | ... +----------------+----------+- +-----------+----------+- | Host | User | ... +-----------+----------+- | localhost | root | ... | localhost | | ... | % | jeffrey | ... | % | root | ... +-----------+----------+- +-----------+----------+- | Host | User | ... +-----------+----------+- | % | root | ... | % | jeffrey | ... | localhost | root | ... | localhost | | ... +-----------+----------+-