"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > How Do I Store Unicode Data in MySQL?

How Do I Store Unicode Data in MySQL?

Published on 2025-01-14
Browse:741

How Do I Store Unicode Data in MySQL?

Unicode Storage in MySQL

In MySQL, Unicode storage is accommodated through the use of appropriate character sets. Unlike SQL Server's nvarchar type, MySQL employs different character sets to encode data. Notably, the free edition of MySQL provides support for Unicode.

To store Unicode in MySQL, follow these steps:

  1. Choose a UTF-8 Character Set:
    When creating a table, specify a character set that begins with "utf8_". For example, "utf8", "utf8mb4", or "utf8mb4_0900".
  2. Use Text or BLOB Data Types:
    Text fields (such as TEXT, VARCHAR, and CHAR) and binary large object (BLOB) fields (such as MEDIUMBLOB and LONGBLOB) will automatically store data in UTF-8 when a UTF-8 character set is chosen for the table.
  3. MySQL 6 and UTF-16 Support:
    Note that UTF-16 support is still in development in MySQL. It is expected to be available in MySQL 6.
Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3