Save emoji in MySQL

Change charset to “utf8mb4” and collation to “utf8mb4_unicode_ci”

emoji example:

Hdhdhdh????hzhzhzzhjzj 我爱你 ❌

  • DB table
    Set COLLATE ‘utf8mb4_unicode_ci’
  • DB connection

Reference:

  1. http://www.hangge.com/blog/cache/detail_1411.html
  2. https://stackoverflow.com/questions/39463134/how-to-store-emoji-character-in-my-sql-database