I have a CiviCRM install on Windows shared server operated by a client. The installation was originally set up on a dedicated Ubuntu Linux virtual server, but was transferred to the Windows server at their request.
Since the transfer from Linux to Windows I am getting frequent MySQL errors when trying to edit or add custom fields.
The following is a typical error in the CiviCRM logs:
ALTER TABLE civicrm_value_mycustomfield_8
ADD COLUMN `myfield_year_142` double DEFAULT '\x012021\x01',
ADD INDEX INDEX_myfield_year_142 ( myfield_year_142 )
[nativecode=1067 ** Invalid default value for 'myfield_year_142']
As you can see, CiviCRM is creating queries that try to insert hexadecimal character codes into numeric fields. The default being set should be '2021'.
The MySQL database on the server being used I note is cp1252 West European (latin1), although I wouldn't usually expect that to cause problems. Table collation (which doesn't affect numeric tables anyway) is utf8_unicode_ci.
- CiviCRM version 5.37.2
- MySQL 5.7.34
- PHP 7.3
I've resorted to manually running MySQL queries to get custom fields established properly, but obviously there are all sorts of reasons why that is not a great idea.
Does anybody know what's going on here, and how to resolve it?