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.
发布了871 篇原创文章 · 获赞 1322 · 访问量 97万+

猜你喜欢

转载自blog.csdn.net/The_Time_Runner/article/details/105446599