mysql template - prefix is sometimes broke

Virtualmin 3.64 GPL

I use a mysql template with the following
Default database name = ${PREFIX}db
Prefix for additional databases = ${PREFIX)

for domains with TLD of .com this works fine and I get a database of example_db and additional databases have a prefix of example_

If the domain TLD is .org then I get a database of mydomain_org_db and additional databases have a prefix of mydomain_org_

There are only 5 domains on my server, no conflicts with domain names.

Am I seeing a bug or is this expected behavior (and why)?

Thanks.

This is expected behavior - the PREFIX is always unique between virtual servers, so if you already have example.com (with prefix ‘example’) and then add example.org, it’s prefix will be example.org to avoid a clash.

If this bothers you, it is possible to manually set the prefix on the virtual server creation form, in the ‘Advanced options’ section.

There was no conflict. nothing even remotely close. This was only the 5th virtual server added. The other four are not conflicts. I just created yet another domain, testing.org. The name has never been used on this server. Same problem.
Dean-

Was there perhaps an existing Unix user or group called ‘mydomain’ ? If so, Virtualmin will set the domain’s admin user to be mydomain.org, and will also set the prefix to match.

no. and the test i just run, creating yet another virtual domain with a name that has never been used anywhere on my server, had the same symptom.
-dean-

I just remembered there is another option that controls the prefix - if you go to System Settings -> Module Config -> Defaults for new domains, the ‘Domain name style in username’ field being set to ‘Full domain name’ will force use of the longer prefix.

You nailed it. My testing was flawed. When I saw the unexpected behavior, I didn’t go back and test the domain names similar to the already installed ones, so I assumed (yes I know what that makes me) it was a problem of the TLD. I also forgot I had tweaked the configs. dumb.

Thanks for your help, sorry to waste bandwidth with cockpit error.
-dean-

No problems - glad you got it worked out!