[Koha] [Important] Update your MySQL|MariaDB configuration to avoid data loss

Bortel, Gary gary.bortel at sos.wa.gov
Fri Aug 4 03:13:17 NZST 2017

I tried implementing multiple init-file= statements(...one for each instance of Koha hosted on our machine...) in our my.cnf file along with multiple init-file_kohaxxx.sql files. Looking at the mysql error.log, it appears only the last init-file= statement was read and executed upon restart. I've dropped back to using a single init-file= statement and one mega-file incorporating sql code for all Koha instance. Things seem to be working fine for now.




-----Original Message-----
From: Jon Knight [mailto:J.P.Knight at lboro.ac.uk] 
Sent: Wednesday, August 02, 2017 2:46 AM
To: Bortel, Gary <gary.bortel at sos.wa.gov>
Cc: koha at lists.katipo.co.nz
Subject: Re: [Koha] [Important] Update your MySQL|MariaDB configuration to avoid data loss

On Tue, 1 Aug 2017, Bortel, Gary wrote:
> For a multi-tenant installation with multiple MySQL databases...
> "The Solution" 
> (https://wiki.koha-community.org/wiki/DBMS_auto_increment_fix)
> recommends adding "init-file=/var/lib/mysql/init-file_kohadev.sql" in 
> the my.cnf MySQL configuration file, then creating the appropriately 
> configured "init-file_kohadev.sql" file. Where there are multiple Koha 
> databases, should one add multiple "init-file=..." statements to 
> my.cnf as well as multiple init-file_kohadev.sql files? Or will MySQL 
> only accept one init-file directive in which case the .sql file would 
> include multiple blocks of code...one for each database?

I'd say that its up to you really - both will work.  If you use just one "init-file_kohadev.sql" file you'll just have to repeat all the SQL, just changing the database in the "use" line. If you've got lots of Koha instances that file is going to be quite long.

Personally for tidiness and ease of maintenance I'd probably opt for one init file per Koha database, as those would be clearer and could then be maintained more easily using normal Linux command line tools and a few Perl scripts.  I assume people hosting lots of tenants are probably using tools like Ansible to set up provisioning of a new Koha instance so these files would be created from a template and just one line added/removed from the my.conf file.


More information about the Koha mailing list