Home > Database > Mysql Tutorial > How Do I Store Unicode Data in MySQL?

How Do I Store Unicode Data in MySQL?

Barbara Streisand
Release: 2024-11-27 12:45:12
Original
358 people have browsed it

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.

The above is the detailed content of How Do I Store Unicode Data in MySQL?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template