Description:
I provide MySQL service via docker, the used image is `mysql/mysql-server:8.0.23`.
Now i want to connect database from the host machine, not in the container.
So i create two users:
```
mysql> SELECT user, host FROM user;
+------------------+---------------+
| user | host |
+------------------+---------------+
| learner_maskip | 172.21.0.0/16 |
| learner_fullip | 172.21.0.2/16 |
| healthchecker | localhost |
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+------------------+---------------+
7 rows in set (0.00 sec)
```
User `learner_maskip` work well, while `learner_fullip` did not.
Access database via `learner_fullip` failed:
```
$ mysql -u learner_fullip -h 127.0.0.1 -p
Enter password:
ERROR 1045 (28000): Access denied for user 'learner_fullip'@'172.21.0.1' (using password: NO)
```
Access database via `learner_maskip` successful:
```
$ mysql -u learner_maskip -h 127.0.0.1 -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 405
Server version: 8.0.23 MySQL Community Server - GPL
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
```
I expect that both `learner_maskip` and `learner_fullip` should access database successfully.
How to repeat:
Create user, the `host` is CIDR notaion with full ip address.
```
mysql> CREATE USER 'learner_fullip'@'172.21.0.2/16';
```
Try to access database via this new user in the host machine, not in the container.
It will be failed.