Description:
8.2.0 release note describes
> Host name '%' in grants. The treatment of %by the server as a synonym for localhost when checking privileges is now also deprecated and thus also subject to removal in a future version of MySQL.
https://dev.mysql.com/doc/relnotes/mysql/8.2/en/news-8-2-0.html
But actually, "The treatment of %by the server as a synonym for localhost" is wrong.
This behavior, union indivisual grants and '%' account grants, occurs not only 'localhost' .
How to repeat:
192.168.122.1 is IPAddress of my environment, please fix to your environment.
mysql82 9> CREATE USER yoku0825@'%';
Query OK, 0 rows affected (0.01 sec)
mysql82 9> CREATE USER yoku0825@192.168.122.1;
Query OK, 0 rows affected (0.00 sec)
mysql82 9> GRANT ALL ON percent.* TO yoku0825@'%';
Query OK, 0 rows affected (0.01 sec)
mysql82 9> GRANT ALL ON ipaddr.* TO yoku0825@192.168.122.1;
Query OK, 0 rows affected (0.01 sec)
$ mysql82 -h192.168.122.1 -uyoku0825
mysql82 12> SHOW GRANTS;
+------------------------------------------------------------------+
| Grants for yoku0825@192.168.122.1 |
+------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `yoku0825`@`192.168.122.1` |
| GRANT ALL PRIVILEGES ON `ipaddr`.* TO `yoku0825`@`192.168.122.1` |
+------------------------------------------------------------------+
2 rows in set (0.00 sec)
### The grant for `percent` is not described.
### But actually grants for `percent` are there.
mysql82 12> CREATE DATABASE percent;
Query OK, 1 row affected (0.01 sec)
mysql82 12> CREATE TABLE percent.t1 (num INT);
Query OK, 0 rows affected (0.03 sec)
mysql82 12> DROP DATABASE percent;
Query OK, 1 row affected (0.02 sec)
Suggested fix:
Fix the docs, this is not only 'localhost'.