Mysql – Difference between host ‘*’ and host ‘%’

mariadbMySQL

When I run the following command:

SELECT user, host, password, plugin FROM mysql.user WHERE user='user_123';

this is what I get:

+----------+---------------------------------------+-------------------------------------------+-----------------------+
| user     | host                                  | password                                  | plugin                |
+----------+---------------------------------------+-------------------------------------------+-----------------------+
| user_123 | IPv4-address-1                        | *775F9B443B3F45EC0042CE69872E7CF2D20D7FB4 | mysql_native_password |
| user_123 | IPv4-address-2                        | *775F9B443B3F45EC0042CE69872E7CF2D20D7FB4 | mysql_native_password |
<snip>
| user_123 | domain-1                              | *775F9B443B3F45EC0042CE69872E7CF2D20D7FB4 | mysql_native_password |
| user_123 | domain-2                              | *775F9B443B3F45EC0042CE69872E7CF2D20D7FB4 | mysql_native_password |
<snip>
| user_123 | %                                     | *775F9B443B3F45EC0042CE69872E7CF2D20D7FB4 | mysql_native_password |
| user_123 | *                                     | *775F9B443B3F45EC0042CE69872E7CF2D20D7FB4 | mysql_native_password |
+----------+---------------------------------------+-------------------------------------------+-----------------------+

Q) I know that % stands for the wildcard, but what is the difference between % and *?

Best Answer

Per create user % has a wildcard meaning. _ also matches a single character like the like expression.

* has no meaning and was probably put there by someone not familiar with what they are doing. Recommend dropping this use.