How to delete Virtual Server but Preserve MySQL Database and User

5 posts / 0 new
Last post
#1 Mon, 01/24/2011 - 14:17
katir

How to delete Virtual Server but Preserve MySQL Database and User

We completed development of a new site (upgrade to new version of XOOPS) in a Virtual server I set up

dev.hinduismtoday.com with admin user devtoday, new XOOPs MySQL "devtoday" with MySQL user "devtoday"

When it was done it was a simple job to get the new content to go live on the existing "Live" virtual server:

mv /home/currentLiveSite /home/currentLiveSite-backup mv /home/devtoday /home/htoday

chown -R htoday:htoday htoday

go back and fix the immutables (fortunately your other thread on this saved my day) for the php5.fcgi and change it's owner and "viola" new site was live at www.hinduismtoday.com

BUT: in the main config for the new XOOPS site we are pointing to the new database and it logs in to MySQL as the user for the development site "devtoday" and I need to leave it that way...

So I want to just delete the virtual server "dev.hinduismtoday.com" and enter this as an alias for www.hinduismtoday.com (I already changed the IP of the dev site in our DNS matrix) but we need to preserve the MySQL user "devtoday" which is the admin for the virtual site to be deleted as well as the database "devtoday"

But the VirtualMIn Delete Server option does not allow selective choices among the following:

1 Administration user - The administration user and group for this virtual server will be deleted. 2 Home directory - The home directory for this virtual server, containing all website and otherwise, will be deleted. 3 Apache website - All Apache directives in the virtual host will be removed. 4 Log file rotation - The Logrotate configuration for the virtual server's log files will be deleted. 5 MySQL database - All MySQL databases, all tables and the server's MySQL login will be deleted. 6 ProFTPd virtual FTP - All ProFTPd directives in the virtual server will be removed. 7 Webmin login - The Webmin user for this virtual server will be deleted.

Of these seven actions I need them all to run but not # 5...as the database, tables and mySQL user log in need to be preserved.

How can I accomplish this? I can tackle it 'piece meal" i) remove directives for old site by hand editing the httpd.conf ii) ?? iii) ?? for each of the above 1,2,3,4,6,7 deletions.

I supposed I could have used the "move virtual server" option, but since I don't understand well what that does I did it "by hand"

Mon, 01/24/2011 - 16:28
Locutus

Virtualmin has a built-in function for that:

Select the virtual server you wish to delete, and go to Edit Databases -> database-name, there click "Disassociate with server".

Then you can delete the vserver and the database will stay untouched (while the vserver's MySQL login will still get deleted).

Mon, 01/24/2011 - 21:34
katir

Ok but there was a caveat: even after the disassociation is made, any entry for database permissions (even for another user) is removed from the MySQL ACL!

I had previously entered a new user with permissions to the devtoday database, "htoday" and I entered that in the mainfile.php conf for dbase access. then did the disassociation and delete the virtual server.

I then had one scary moment when XOOPS told me it could not find the data base Oh My! Virtual Min deleted the dbase afterall! YikeS! but no... that was not the case, it had removed all references in the MySQL ACL to the data base, even those users not in any away associated with the virtualserver being deleted.

I had to quickly add the new database permissions to the devtoday dbase (which was indeed still intact) and viola) for the current user and it came to life again.

I would consider this a small bug. If you have disassociated the database from the server, it should not then be deleting all data base permissions for that database, it should only delete the database permissions associated with the admin user for the virtual server being deleted, not others.

Tue, 01/25/2011 - 13:46
Locutus

So you entered that user directly in the Webmin MySQL module, and not in Virtualmin? If so, yeah you're right, I'd also consider this a bug.

You might want to file a bug report in the issues section, so that the developers here are sure to read it. :)

Tue, 01/25/2011 - 14:34
katir

exactly, I had added database permissions from inside WebMin for user "htoday" which was already set in the global permissions with password and "No" access to any databases other than it's old one... I added that user to the database permissions for devtoday data base, disassociated that data base from the dev.hinduismtoday.com virtual server, deleted the server and then the database permissions for the disassociated dbase "devtoday" for use "htoday" got wiped.

I will file a bug report.

Topic locked