Mysql utf8mb4

Hi there,

I am currently running into problems when trying to use django with a MariaDB (MySQL) database and utf8mb4_bin as the collation.
Everytime a user submits a string with an emoji an error occurs and I am unable to fix this.
Things I already tried:

  • adding OPTIONS → charset → utf8mb4_bin to the django database settings but I only get an error message:
MySQLdb._exceptions.OperationalError: (2019, "Can't initialize character set utf8mb4_bin (path: /usr/share/mysql/charsets/)")
Character set 'utf8mb4_bin' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
  • adding utf8mb4 charset to the /usr/share/mysql/charset/Index.xml file. The above error still occured

I do not really know what to do and was unable to find an answer on the internet that fixed my problem.
My Server is running Ubuntu 20.04 with MariaDB 10.3.29 and Django 3.1.5, Python 3.8.10 (I know that newer versions are available).

I appreciate all help.