External DB server as primary DB server

OS type and version Ubuntu 22
Virtualmin version 7.10.0

Hi Guys,

I encountered the following issue and I couldn’t find how to fix it, however, I found a workaround as described below.

I’ve got 2 servers: 1 web and 1 DB server. Web server has 2 IP’s 1 public and 1 private. DB server has only 1 private IP. Both servers have the same private network and are directly connected.

From “Virtualmin > System Settings > Database Servers” I’ve added my DB server to the list and made it default DB server, so when I create a Virtual server, user and DB are created on it.

The problem is that when I create a Virtual server DB user is created as follows:

# SELECT user,host FROM mysql.user;
| User          | Host          |
| db_user       |       |

Where is my public IP and the connection does not work. I couldn’t find how to change this from DB server settings, so I added extra allowed DB host from the following menu:

“Virtualmin > Server Templates > MariaDB Database > Allowed MariaDB client hosts”

This is a workaround as when I create Virtual server both public and private IP’s are added to mysql user.

My question is, is there any more elegant way to avoid adding the public IP to DB user allowed host?

Kind Regards,