Starting Django on Docker Alpine Results in django.db.utils.OperationalError: (2000, 'Unknown MySQL error')

Django
2020-09-13 15:57 (4 years ago) ytyng

Alpine 3.12, django 3.1, mysqlclient 2.0.1

When running python3 ./manage.py runserver 8080,

 File "/usr/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/usr/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 73, in execute
return self.cursor.execute(query, args)
File "/usr/lib/python3.8/site-packages/MySQLdb/cursors.py", line 206, in execute
res = self._query(query)
File "/usr/lib/python3.8/site-packages/MySQLdb/cursors.py", line 319, in _query
db.query(q)
File "/usr/lib/python3.8/site-packages/MySQLdb/connections.py", line 259, in query
_mysql.connection.query(self, query)
django.db.utils.OperationalError: (2000, 'Unknown MySQL error')

The above error occurred.

The settings are

DATABASES = {
'default': {
   'ENGINE': 'django.db.backends.mysql',
  'NAME': '*****',
   'USER': '*****',
  'PASSWORD': '*****',
   'HOST': '*****',
  'PORT': '3306',
  'OPTIONS': {
  'charset': 'utf8mb4',
  },
},
}

With this configuration,

the error (2000, 'Unknown MySQL error') occurs when 'charset': 'utf8mb4' is included in the OPTIONS.

When this setting is removed or changed to utf8, the error does not occur.

The detailed cause is unknown.

Currently unrated

Comments

Archive

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