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

How to modify rare words in data by mysql

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to modify the obscure words in the data by mysql". Friends who are interested may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to modify rare words in data by mysql".

1. Modify fields where obscure words may be inserted, such as:

ALTER TABLE news CHANGE title title VARCHAR (255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT''COMMENT' title'

In addition to modifying the character set, the storage needs to be increased.

2. Set the mysql character set:

Mysql > set character_set_client=utf8mb4

Mysql > set character_set_connection=utf8mb4

Mysql > set character_set_database=utf8mb4

3. PHP connection mysql is also set to utf8mb4, otherwise reading obscure words will only show a question mark

Just complete the above three steps.

Of course, the ideal setting is that all database table fields, php programs, are set to utf8mb4.

-modify the character set of the table in batch

Execute the query:

SELECT CONCAT ('ALTER TABLE', TABLE_NAME,' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;') FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'database name'

Then copy the sql statement and run it.

At this point, I believe you have a deeper understanding of "how mysql modifies the obscure words in the data". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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