当前位置:网站首页>如何消除 MySQL表中的字段特别设置的字符集和排序规则?
如何消除 MySQL表中的字段特别设置的字符集和排序规则?
2022-07-22 08:14:00 【Shawn】
希望列跟表看齐
其他答案1:
重新指定字段字符集即可(排序规则默认)
CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, `serial_no` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;alter table t1 modify `serial_no` varchar(50) CHARACTER SET utf8mb4 NOT NULL;show create table t1;/*CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, `serial_no` varchar(50) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4*/
其他答案2:
mysql 有语句可以重新指定全表字符集。
CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, `serial_no` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
执行语句:
ALTER TABLE t1 CONVERT TO CHARACTER SET utf8mb4;
CREATE TABLE t1
(id
int NOT NULL AUTO_INCREMENT,serial_no
varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
PRIMARY KEY (id
)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
官方文档介绍
To change the table default character set and all character columns (CHAR, VARCHAR, TEXT) to a new character set, use a statement like this:
ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
边栏推荐
- 17、 C function pointer and callback function
- How Allegro imports pictures such as high-definition logo, QR code, anti-static logo and Chinese characters
- How to declare the default value in go language structure and how to convert it into JSON data
- ieee下载文献的方法
- GBase8s数据库UNION 运算符
- GBase8s数据库SET AUTOFREE 语句
- 逻辑回归(公式推导+numpy实现)
- 以SPI的仿真文件学习TB写法
- Do all Navicat versions support MySQL? Why can't I open the connection?
- Bigder: common business terms in 36/100 report testing
猜你喜欢
飞机大战中对象池模式子弹使用
超实用转型攻略:《2022央国企云原生落地实用指南》正式发布
Rk3399 platform development series explanation (alsa subsystem) 4.37, alsa driven framework
云原生强势发展,企业该如何抓住业务机遇
43. 字符串相乘
线性回归(公式推导+numpy实现)
VCs and Verdi learning records
Dokcer running Nacos container automatic exit problem
Go concurrent programming - work pool
Web3 sharing
随机推荐
线性回归(公式推导+numpy实现)
Bigder: common business terms in 36/100 report testing
Union in gbase8s database subquery
力扣练习——24 去除重复字母
Rk3399 platform development series explanation (input subsystem) 4.52. Implementation principle of input subsystem
VCs and Verdi learning records
go对接口简单理解
基于信誉管理模型的矿工类型鉴别机制设计
QT笔记——网络通信 之 QUdpSocket
Computer Graphics From Scratch - Chapter 4
Differences between MySQL and MariaDB
Hblock盘活企业级存储市场
How to declare the default value in go language structure and how to convert it into JSON data
学IT,你后悔了么?
飞机大战中对象池模式子弹使用
【案例分享】配置IS-IS的路由渗透功能
Gbase8sunion all operator
力扣练习——26 分割数组为连续子序列
一招教你招聘数据可视化~还有人不会这些数据分析小案例吗?
力扣练习——35 组合总和 II