mysql django.db.utils.InterfaceError: (0, '')
DjangoMySQL
2020-11-08 10:53 (5 years ago)

django.db.utils.InterfaceError: "(0, '')"
When this error appears
If this error occurs intermittently when retrieving records or tables, the connection character encoding might not be correct.
If you are connecting with utf8, try switching to utf8mb4 and see if that resolves the issue.
DATABASES = {
"default": {
"ENGINE": "django.db.backends.mysql",
"NAME": "....",
"USER": "....",
"PASSWORD": "....",
"HOST": "....",
"PORT": "",
"OPTIONS": {
"charset": "utf8mb4"
},
Additional note on 2021-08-07
As mentioned in the above link, when the MySQL client is version 8.0 and the server is version 5.7, the character encoding cannot be specified from the client-side.
Therefore, regarding character encoding, it is best to specify it on the server-side and not specify it from the client-side
(do not specify OPTIONS in the DATABASES).
Please rate this article (No signup or login required)
Currently unrated
Related posts
How to Fix Display Issues in Django Admin Inlines After Upgrading to 5.1
Return Login and Redirect Views by Hardcoding Social Account Provider in django-allauth (When Using AWS Cognito, etc.)
Here's the English translation of your blog title:"A Story About Trying to JOIN Fields with Different Collations in MySQL and Getting 'Range checked for each record'"
After Upgrading to Django 5 and Updating Dependencies, SSL: CERTIFICATE_VERIFY_FAILED Error Occurs When Sending Emails
The author runs the application development company Cyberneura.
We look forward to discussing your development needs.
We look forward to discussing your development needs.