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

Django MySQL
2021-11-14 20:10 (3 years ago) ytyng

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

Current rating: 1
The author runs the application development company Cyberneura.
We look forward to discussing your development needs.

Comments

Archive

2025
2024
2023
2022
2021
2020
2019
2018
2017
2016
2015
2014
2013
2012
2011