[BlueOnyx:25975] Re: Adding existing mysql database/users

Darren Wolfe darren at intersys-group.com
Thu Feb 16 21:27:05 -05 2023


Thanks, but I may not have explained myself correctly.

In mysql I already have many users and databases, entirely outside the scope of the gui, none of which were created using the gui.
I now want to bring these existing users and databases into the gui, but I want to avoid the painful task of enabling mysql on each vsite, noting the created mysql username/db/password, moving the database from its old name to its new name, and updating configuration files for the websites.

If I enable mysql in the vsite, It won't let me enter an existing db/username/password as it says they already exist, so I don't know how to achieve what I want.

So what I want is a way to force the gui to accept the existing mysql db/username/password that I give it without trying to create the user or database itself.

Thanks



> -----Original Message-----
> From: Blueonyx <blueonyx-bounces at mail.blueonyx.it> On Behalf Of
> Michael Stauber
> Sent: 17 February 2023 02:02
> To: blueonyx at mail.blueonyx.it
> Subject: [BlueOnyx:25974] Re: Adding existing mysql database/users
> 
> Hi Darren,
> 
> > Is there a way of adding an existing mysql database and mysql user to an
> > existing vsite, so that it then appears and can be managed in the gui?
> 
> In 5210R/5211R under "Site Management" / <Site> / "Services" / "MariaDB"
> you can simply edit "Allowed Databases" to allow more databases.
> 
> This also works on 5209R, but there the option for it is listed under
> "Site Management" / <Site> / "Services" / "Web" and it's also named
> "Allowed Databases".
> 
> > I need to do this in bulk too, so a scriptable cli method would be ideal!
> 
> This will do the trick and it'll work on 5209R/5210R/5211R:
> 
> ------------------------------------------------------------------------
> #!/usr/bin/perl -I/usr/sausalito/perl
> 
> # How many DBs do we allow?
> $maxDBs = '10';
> 
> use CCE;
> my $cce = new CCE;
> $cce->connectuds();
> 
> # Find all Vsites:
> my @vhosts = ();
> my (@vhosts) = $cce->findx('Vsite');
> 
> print "Going through all sites to set MariaDB 'maxDBs' to: $maxDBs: \n";
> 
> # Walk through all Vsites:
> for my $vsite (@vhosts) {
>      ($ok, my $my_vsite) = $cce->get($vsite);
>      print "Processing Site: $my_vsite->{fqdn} \n";
>      ($ok) = $cce->set($vsite, 'MYSQL_Vsite', { 'maxDBs' => $maxDBs });
> }
> 
> # Close CCEd connection and exit:
> $cce->bye('SUCCESS');
> exit(0);
> ------------------------------------------------------------------------
> 
> Just edit line 4 ...
> 
> $maxDBs = '10';
> 
> ... to reflect the number of DBs you want to grant and execute the
> script. It'll walk through all existing Vsites and it will set this value.
> 
> You need to run this script as "root".
> 
> Please note: It won't enable MariaDB/MySQL if a Vsite doesn't have it
> enabled yet.
> 
> --
> With best regards
> 
> Michael Stauber
> _______________________________________________
> Blueonyx mailing list
> Blueonyx at mail.blueonyx.it
> http://mail.blueonyx.it/mailman/listinfo/blueonyx




More information about the Blueonyx mailing list