Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the common problems of character encoding in mysql database

2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the common problems of character coding in mysql database. It is very detailed and has certain reference value. Friends who are interested must finish reading it.

First, display character set settings through the command line

Show variables like 'character_set%'

First, character_set_client is the character set encoding of the transmitted data.

Second, character_set_connection is the character set encoding when connecting to the database.

Third, character_set_results is the character set encoding when the result is returned.

Third, character_set_database is the character set encoding of the current database.

Fifth, character_set_server is the character set encoding of the server.

Sixth, character_set_system is the encoding of database identifiers, such as database names, table names, field names, and so on.

Sending process: client (client send code)-> connection (data connection code)-> [server internal code]-> return result code.

II. Character set and verification rules

1. Proofreading rules.

The proofreading rule consists of three parts: character set encoding _ language region _ comparison rules.

Character set encoding: gbk, utf8, etc., are all character set codes.

Comparison rules: three kinds of ci cs bin.

2. Check the proofreading rules:

Show collation like 'xxxx';// Fuzzy query show collation

For example: show collation like 'gbk%'; is actually a query to the library.

3. The difference between gbk_ci and gbk_bin

Gbk_ci proofreading rules are case-insensitive, but gbk_ci is sorted by pinyin. This feature is not available in utf8_generation_ci.

Gbk_bin is sorted by character Ascall encoding.

You can use the statement:

Select * from tbl_name order by field name; / / check

4. Selection of gbk and utf8

When storing Chinese characters, use the gbk character set, which takes up two bytes. Using utf8 takes 3 bytes. But gbk is only suitable for mainland websites, and utf8 is suitable for world standards. As for how to choose the direction to be done.

These are all the contents of this article entitled "what are the common problems with character encoding in mysql database?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report