This may be a “duh” post for some, but I had to post this because I didn’t find the answer in typical places like stackoverflow when I had the issue. I recently worked on a project to expand database capacity by deploying new MySQL installations with memory, config, and disk space tweaks by backup/restore, replication topology change and, and failover. I did not notice that the old servers had “explicit_defaults_for_timestamp=OFF”. After restoring a binary backup and starting the replication thread on the new systems I got this error in the replication thread (column name in error corresponds to examples further down).
ERROR 1048 (23000): Column 'ts' cannot be null
Below, I will provide a synopsis to show statements that caused the error and why a simple global variable change fixed the issue. First, a sample table definition.
CREATE …[Read more]