mysql utf8跟utf8mb4_MySQL utf8 和 utf8mb4 的区别
utf-8 時變化長度的編碼,儲存一個code point 需要1~4個字節.
然而,mysql的utf8只存儲最多3個字節per code point.
所以,utf8字符集不能存儲所有的unicode code points.
只能從0x000 to 0xFFFF(叫做Basic Multilingual Plane:BMP)
The character set named utf8 uses a maximum of three bytes per character and contains only BMP characters. As of MySQL 5.5.3, the utf8mb4 character set uses a maximum of four bytes per character supports supplemental characters:
For a BMP character, utf8 and utf8mb4 have identical storage characteristics: same code values, same encoding, same length.
For a supplementary character,?utf8 cannot store the character at all, while utf8mb4 requires four bytes to store it. Since utf8 cannot store the character at all, you do not have any supplementary characters in utf8 columns and you need not worry about converting characters or losing data when upgrading utf8 data from older versions of MySQL.
So if you want your column to support storing characters lying outside the BMP (and you usually want to), such as?emoji, use "utf8mb4". See also?What are the most common non-BMP Unicode characters in actual use?.
總結
以上是生活随笔為你收集整理的mysql utf8跟utf8mb4_MySQL utf8 和 utf8mb4 的区别的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysql 更新表格数据_mysql更新
- 下一篇: docker mysql开机自启动_Do