As some emojis are using unicode code points beyond what can be represented with a three byte utf8 encoding, it is recommended to use utf8mb4 for columns that are used to store emojis. Alternatives are ucs16, ucs16le, and ucs32.
For example:
mysql> CREATE TABLE emoji (id int unsigned NOT NULL PRIMARY KEY, val varchar(12) NOT NULL) DEFAULT CHARSET=utf8mb4; Query OK, 0 rows affected (0.57 sec) -- Insert a value containing the emojis "high voltage sign" and "face screaming in fear": mysql> INSERT INTO emoji VALUES (1, CONCAT(0xE29AA1, ' is scary ', 0xF09F98B1)); Query OK, 1 row affected (0.07 sec) mysql> SET SESSION character_set_results = utf8mb4; Query OK, 0 rows affected (0.00 sec) mysql> SELECT * FROM emoji; +----+-------------------+ | id | val | +----+-------------------+ | 1 | ⚡ is scary �� | +----+-------------------+ 1 row in set (0.00 sec)
The output above should be similar to the below screen shot if the terminal supports displaying the emojis:
Be sure to test with the whole range of emojis being required for your application. Some emojis such as ⚡ can be stored in MySQL’s 3-byte utf8 encoding, but others such as face screaming in fear cannot.