Bug #84761 Updating MySQL overwrites collation
Submitted: 1 Feb 2017 3:48 Modified: 24 Feb 2017 17:37
Reporter: billy noah Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Charsets Severity:S3 (Non-critical)
Version:5.7.17 OS:Ubuntu (16.04.1)
Assigned to: Lars Tangvald CPU Architecture:Any
Tags: charset, collation, ubuntu

[1 Feb 2017 3:48] billy noah
Description:
I recently added a new collation to MySQL as outlined here (http://dev.mysql.com/doc/refman/5.7/en/full-text-adding-collation.html)  for the purpose of including a dash `-` character in fulltext searches.  It worked fine but a couple of days later my changes were overwritten by the apt.systemd.daily Unattended-Upgrade routine.

Is there an upgrade-proof way to modify MySQL collation / charsets?  I understand some system files are not meant to be altered, but typically there would be an appropriate user configuration file where those changes can be applied.  Since I followed the official guidelines, I am surprised that these are files which would be replaced by an automatic system process.

Just to be 100% clear I'm the edits were made to the following two files (which are referenced in the article I linked above):

 - /usr/share/mysql/charsets/Index.xml
 - /usr/share/mysql/charsets/latin1.xml

This was posted as a question here: http://askubuntu.com/questions/874190/mysql-update-overwrites-collation and the only feedback I got was to submit a bug report as "Upgrades --never-- --ever-- should change table definitions. Never. That is user data and not system data so it has to be out of the reach of any form of updates."

If this is, in fact, not a bug, can the documentation be updated to offer an upgrade proof method of adding a collation?

How to repeat:
1. Add a collation to the Index.xml file.
2. Declare the sort order for the collation in the latin1.xml file.
3. Modify the ctype array in latin1.xml.
4. run "apt upgrade" or use the package manager of your choice to update the package to a newer version
5. observe your changes are now gone.
[9 Feb 2017 13:17] Lars Tangvald
At least in the short term we can handle this by flagging that file as a conffile (changes will not be automatically overwritten on package upgrade).
[24 Feb 2017 17:32] Paul Dubois
Posted by developer:
 
Noted in 5.6.36, 5.7.18, 8.0.1 changelogs.

For Debian/Ubuntu packages, user-defined collation files could be
overwritten during MySQL upgrades. Charset files are now marked as
conffiles so that user customizations generate a prompt during
upgrades whether to overwrite them.
[24 Feb 2017 17:37] billy noah
Thank you!