[LON-CAPA-admin] loncapa with remote mysql server?

Todd Pfaff pfaff at rhpcs.mcmaster.ca
Fri Oct 18 12:26:01 EDT 2019

Hi Stuart,

Thanks for the quick response, and for getting me on this list today.

What you've reported below is the track I was on.  I also found an 
instance in:


that comes into play when running UPDATE.  I have made the necessary 
changes in all of those locations and it seems to work just fine.

This is mostly just a curiosity for me right now since we can continue to 
run our loncapa deployment without integrating the mysql portions into our 
central mysql infrastructure.  Not a showstopper for us at this time.

I'm wondering if there's any appetite for this part of the code to be 
refactored such that all occurrences of mysql db connections are done in 
one piece of reuseable code.  Is there active development of loncapa, and 
plans for a new release?  I'd prefer to see this change make it back into 
the codebase than for me and perhaps others have to patch this in.


On Fri, 18 Oct 2019, Raeburn, Stuart wrote:

> Todd,
> I found eight instances of DBI->connect() in the LON-CAPA code, in the following files:
> /home/httpd/perl/cleanup_database.pl
> /home/httpd/perl/lonsql  (2 instances)
> /home/httpd/perl/searchcat.pl
> /home/httpd/lib/perl/Apache/lonmysql.pm (2 instances)
> /home/httpd/cgi-bin/metadata_harvest.pl
> /home/httpd/cgi-bin/metadata_keywords.pl
> I have not tried using a remote mysql server, but it seems you should be able to replace
> DBI->connect("DBI:mysql:$dbname", ....
> with
> DBI->connect("DBI:mysql:database=$dbname;host=$hostname;port=$port", ....
> (where $dbname is database name, $hostname is remote host, and $port is remote port)
> in each of those eight instances, and then configure permissions and users appropriately in the mysql instance on the remote server.
> The LON-CAPA script (install.pl) used to prepare a server/VM for LON-CAPA installation, which is contained in the tar file: http://install.loncapa.org/versions/linux/install.tar
> is used to set up the user and permissions for a MySQL database running on the local server.  Inspection of the part of that perl script that sets up MySQL could assist in setting up the remote mysql server (with a modification to allow connections from the remote LON-CAPA node).
> Stuart Raeburn
> LON-CAPA Academic Consortium
> ________________________________________
> From: LON-CAPA-admin <lon-capa-admin-bounces at mail.lon-capa.org> on behalf of Todd Pfaff <pfaff at rhpcs.mcmaster.ca>
> Sent: Wednesday, October 2, 2019 12:02 PM
> To: lon-capa-admin at mail.lon-capa.org
> Subject: [LON-CAPA-admin] loncapa with remote mysql server?
> Anyone using loncapa with a remote mysql server instead of localhost?
> If yes, do you have a list of loncapa code diffs to implement the
> changes?  I found at least five spots in loncapa perl code where the
> perl DBI->connect string would need to be changed and I'm wondering if
> there are other loncapa code changes that would be required.
> _______________________________________________
> LON-CAPA-admin mailing list
> LON-CAPA-admin at mail.lon-capa.org
> _______________________________________________
> LON-CAPA-admin mailing list
> LON-CAPA-admin at mail.lon-capa.org
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-admin

More information about the LON-CAPA-admin mailing list