'MariaDB - GRANT SELECT ON `DBX`.* TO `admin`@`172.22.%.%` WITH GRANT OPTION - from remote HOST fails

I've two ubuntu host, host01 is the DB Server in host02, and I need to install a PHP Application.
Both hosts are in the same network (172.22)
The installation process requires a user with administrative rights to:

  1. create a database (DBX)
  2. assign grants to the database, for a user.

I've added manually the user (admin) in MariaDB in this way:

  • CREATE USER 'admin'@'172.22.%.%' IDENTIFIED BY 'xxxxxxx';

I have no issue to create the database from host02, but when I try to run the following SQL

  • GRANT SELECT, UPDATE, DELETE, INSERT ON DBX.* TO 'admin'@'172.22.%.%';

I'm always getting: Access denied for user 'admin'@'172.22.%.%' to database 'DBX'

The issue happens when the query is run from the PHP Application, and also if I use the mariadb client from host02, then it seems not related to PHP.

Any idea?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source