In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Let's learn how to adjust the MySQL data table character set, I believe you will benefit a lot after reading, the text is not much in the essence, hope that how to adjust the MySQL data table character set this short content is what you want.
The structure of the data table T1 table.
Mysql > show create table T1\ G
* * 1. Row *
Table: t1
Create Table: CREATE TABLE `t1` (
`id`int (11) NOT NULL AUTO_INCREMENT
`roomt`varchar (30) NOT NULL DEFAULT''
PRIMARY KEY (`id`)
UNIQUE KEY `uniq_ roomt` (`roomt`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8
1 row in set (0.00 sec)
1. Adjust the default charset to utf8mb4.
Mysql > alter table T1 default charset utf8mb4
Query OK, 0 rows affected (0.07 sec)
Records: 0 Duplicates: 0 Warnings: 0
Mysql > show create table T1\ G
* * 1. Row *
Table: t1
Create Table: CREATE TABLE `t1` (
`id`int (11) NOT NULL AUTO_INCREMENT
`roomt`varchar (30) CHARACTER SET utf8 NOT NULL DEFAULT''
PRIMARY KEY (`id`)
UNIQUE KEY `uniq_ roomt` (`roomt`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4
1 row in set (0.00 sec)
two。 Adjust the account field collate to utf8mb4_bin.
Mysql > alter table T1 modify column account varchar (30) collate utf8mb4_bin not null default''
Query OK, 0 rows affected (0.71 sec)
Records: 0 Duplicates: 0 Warnings:
Mysql > show create table T1\ G
* * 1. Row *
Table: t1
Create Table: CREATE TABLE `t1` (
`id`int (11) NOT NULL AUTO_INCREMENT
`roomt`varchar (30) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT''
PRIMARY KEY (`id`)
UNIQUE KEY `uniq_ roomt` (`roomt`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4
1 row in set (0.00 sec)
3. Adjust the default charset, and each field charset to utf8.
Mysql > alter table T1 convert to charset utf8
Query OK, 0 rows affected (1.65 sec)
Records: 0 Duplicates: 0 Warnings: 0
Mysql > show create table T1\ G
* * 1. Row *
Table: t1
Create Table: CREATE TABLE `t1` (
`id`int (11) NOT NULL AUTO_INCREMENT
`roomt`varchar (30) NOT NULL DEFAULT''
PRIMARY KEY (`id`)
UNIQUE KEY `uniq_ roomt` (`roomt`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8
1 row in set (0.00 sec)
After reading this article on how to adjust the character set of MySQL datasheets, many readers will want to know more about it. For more industry information, you can follow our industry information section.
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.