When issuing a query to MySQL (5.7) using Django
(2013, 'Lost connection to MySQL server during query')
the error appeared and the process stopped.
First, check the innodb_strict_mode with the active connection
SHOW VARIABLES LIKE '%innodb_strict_mode%';
It needs to be ON.
https://django-mysql.readthedocs.io/en/latest/checks.html#django-mysql-w002-innodb-strict-mode
This was already ON.
Next, check the sql_mode.
SELECT @@SESSION.sql_mode;
STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Remove NO_ENGINE_SUBSTITUTION from the MySQL server and restart
STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER
This issue no longer appears
Comments