I removed NO_ENGINE_SUBSTITUTION because I got 'Lost connection to MySQL server during query' in Django

DjangoMySQL
2021-11-14 11:10 (4 years ago)
I removed NO_ENGINE_SUBSTITUTION because I got 'Lost connection to MySQL server during query' in Django

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

Please rate this article
Current rating: 1.0 (1)
The author runs the application development company Cyberneura.
We look forward to discussing your development needs.

Categories

Archive