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

Introduction to the method of modifying character set of MySQL table, field and library

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

Share

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

Modify the database character set:

ALTER DATABASE db_name DEFAULT CHARACTER SET character_name [COLLATE...]

Change the default character set and all character columns (CHAR,VARCHAR,TEXT) to the new character set:

ALTER TABLE tbl_name CONVERT TO CHARACTER SET character_name [COLLATE...]

Such as: ALTER TABLE logtest CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci

Simply modify the default character set of the table:

ALTER TABLE tbl_name DEFAULT CHARACTER SET character_name [COLLATE...]

Such as: ALTER TABLE logtest DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci

Modify the character set of the field:

ALTER TABLE tbl_name CHANGE c_name c_name CHARACTER SET character_name [COLLATE...]

Such as: ALTER TABLE logtest CHANGE title title VARCHAR (100) CHARACTER SET utf8 COLLATE utf8_general_ci

View the database code:

SHOW CREATE DATABASE db_name

View the table encoding:

SHOW CREATE TABLE tbl_name

View field codes:

SHOW FULL COLUMNS FROM tbl_name

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