* Whenever the server reads the user table into memory, it sorts the entries.
* When a client attempts to connect, the server looks through the entries in sorted order.
* The server uses the first entry that matches the client hostname and username. To see how this works, suppose that the user table looks like this:
+-----------+----------+-
| Host | User | ...
+-----------+----------+-
| % | root | ...
| % | jeffrey | ...
| localhost | root | ...
| localhost | | ...
+-----------+----------+-
When the server reads in the table, it orders the entries with the most-specific Host values first. Literal hostnames and IP numbers are the most specific. The pattern '%' means ``any host'' and is least specific. Entries 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). For the user table just shown, the result after sorting looks like this:
+-----------+----------+-
| Host | User | ...
+-----------+----------+-
| localhost | root | ...
| localhost | | ...
| % | jeffrey | ...
| % | root | ...
+-----------+----------+-
|