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)?


This is expected behavior - the PREFIX is always unique between virtual servers, so if you already have (with prefix ‘example’) and then add, it’s prefix will be 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, The name has never been used on this server. Same problem.

Was there perhaps an existing Unix user or group called ‘mydomain’ ? If so, Virtualmin will set the domain’s admin user to be, 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.

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.

No problems - glad you got it worked out!