Warning: (3719, "'utf8' is currently an alias for the character set UTF8MB3, but will be an alias

  • 問題描述

    Python使用pymysql出現如題錯誤:

    /home/data/anaconda3/lib/python3.7/site-packages/pymysql/cursors.py:170: Warning: (3719, "'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.")
    
  • 解決方案

    MySQL中的“utf8”並不是真正的UTF-8“utf8”只支持每個字符最多三個字節,而真正的UTF-8是每個字符最多四個字節。

    MySQL一直沒有修復這個bug,他們在2010年發佈了一個叫作“utf8mb4”的字符集,繞過了這個問題。

    MySQL中的utf8mb4是真正的utf8,所以用utf8mb4,不要用utf8這個別名。

  • References

  1. Warning | 3719 | ‘utf8’ is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章