mysql> host % vs host *

Viewed 346

SELECT user, host FROM mysql.user; yields output like the following for us:

+------------------+---------------------------------------+
| user             | host                                  |
+------------------+---------------------------------------+
| %                | %                                     |
| plutot_admin     | %                                     |
| plutot_dev       | %                                     |
| plutot_intrn01   | %                                     |
| plutot_intrn02   | %                                     |
| plutot_ntrn01    | %                                     |
| plutot_ntrn02    | %                                     |
| plutot_tech      | %                                     |
| plutot_ntrn02    | *                                     |
| plutouser        | *                                     |
|   ...            |       ...                             |

% is wildcard host, but what is the significance of * in the query output?

1 Answers

MariaDB (but also MySQL) isn't restrictive and doesn't check the validity of a hostname (RFC 2181) and therefore doesn't claim if a host name contains an asterisk or another invalid character.

The asterisk will not be interpreted as a wild card character, wild cards are limited to percentage (%) and underscore (_).

That means someone created the user with CREATE USER 'plutouser'@'*' command, likely with the assumption that the asterisk will be interpreted as a wildcard character.

Related