Cloning a Server Results in Database Named after Original and Cloned Server Names

I'm going to report this as a big because I dont think this should be the intended behaviour...

But when I clone a server, the new server database is named using the new server name appended to the old server name.

So for example, I have server1.mydomain.co.uk with database name server1, and I clone this to make server2.mydomain.co.uk. I would expect the new database name to be EITHER kept the same as the original (so websites using it would still work with no configuration still) OR renamed to server2.

Instead, what happens is the new database name is server2server1

This means not only do we have to change the website configuration, which is OK, it means we have to create a new database and copy all data from the old database into it, because no one would want to keep their database name as server2server1. if I clone that it would be server3server2server1

P.S. Not having a rename database feature makes this issue all the more a problem

Thanks

Status: 
Closed (fixed)

Comments

What I'd expect to happen is that the DB be cloned as server2 (it can't stay as server1, as MySQL doesn't allow multiple DBs with the same name).

Can you post the actual domain names and database names that this happened for, so I can see why the rename might have gone wrong?

My original domain was skeleton-ee.office.amitywebsolutions.co.uk and database ee-skeleton. I cloned this to make recigb.office.amitywebsolutions.co.uk and the new database was named recigbee-skeleton

Ok - can you also post the output from the following commands run as root on your system :

virtualmin list-domains --domain skeleton-ee.office.amitywebsolutions.co.uk --multiline | grep prefix
virtualmin list-domains --domain recigb.office.amitywebsolutions.co.uk --multiline | grep prefix

This will tell me what database name format Virtualmin expects for those domains.

[root@office ~]# virtualmin list-domains --domain skeleton-ee.office.amitywebsolutions.co.uk --multiline | grep prefix

Mailbox username prefix: skeleton-ee

[root@office ~]# virtualmin list-domains --domain recigb.office.amitywebsolutions.co.uk --multiline | grep prefix

Mailbox username prefix: recigb

Ok, I see the issue now - normally the default database for a domain is named to follow the first part of the domain name, so for skeleton-ee.office.amitywebsolutions.co.uk it would be skeleton-ee . But if your case, it was ee-skeleton , which confused Virtualmin's attempt to select a new name.

Since this is pretty confusing behavior, I'll fix it in the next release.

If I ever stated "ee-skeleton", sorry this was a typo. It was always "skeleton-ee". So ignore "ee-skeleton" and assume "skeleton-ee". Sorry!

So not sure if your reply still stands, but I have clones two more sites today, and same things happened, the new name was added to the front of skeleton-ee for the database.

I have not tried cloning any other site other than skeleton-ee though.

Ok, this may have a different cause then.

Do these domains have more than one database?

Also, what is the output from grep mysql_db= /etc/webmin/virtual-server/config ?

No, skeleton-ee is the only database for its server

[root@office ~]# grep mysql_db= /etc/webmin/virtual-server/config

mysql_db=${PREFIX}

Ok, that also looks fine.

Can you try running the following commands :

ID=\`virtualmin list-domains --domain skeleton-ee.office.amitywebsolutions.co.uk --id-only\`
grep -e db= -e prefix= /etc/webmin/virtual-server/domains/$ID
ID=\`virtualmin list-domains --domain recigb.office.amitywebsolutions.co.uk --id-only\`
grep -e db= -e prefix= /etc/webmin/virtual-server/domains/$ID

Sorry for late reply, I've been quite ill this Christmas :(

Here you go. Although this website has an issue in that I cannot get a single line return. I enter it with single line returns they are all on one line, I enter a double line return and the double line return is output. So I have entered a double line return hence there are gaps which should not be there.

[root@office ~]# ID=virtualmin list-domains --domain skeleton-ee.office.amitywebsolutions.co.uk --id-only

[root@office ~]# grep -e db= -e prefix= /etc/webmin/virtual-server/domains/$ID

prefix=skeleton-ee

db=skeleton-ee

no_mysql_db=1

subprefix=

[root@office ~]# ID=virtualmin list-domains --domain recigb.office.amitywebsolutions.co.uk --id-only

[root@office ~]# grep -e db= -e prefix= /etc/webmin/virtual-server/domains/$ID

prefix=recigb

db=recigbskeleton-ee

no_mysql_db=1

subprefix=

Ok, thanks. I see the bug that causes this, and will include a fix in the next Virtualmin release.

Automatically closed -- issue fixed for 2 weeks with no activity.