MySQL修改编码

修改数据库编码

ALTER DATABASE db_name [[DEFAULT] CHARACTER SET charset_name] [[DEFAULT] COLLATE collation_name]

ALTER DATABASE appblog CHARACTER SET utf8 COLLATE utf8_general_ci;

修改数据库表编码

ALTER TABLE tbl_name [[DEFAULT] CHARACTER SET charset_name] [COLLATE collation_name]

ALTER TABLE t_app CHARACTER SET utf8 COLLATE utf8_general_ci
ALTER TABLE t_language CHARACTER SET utf8 COLLATE utf8_general_ci

修改表字段编码

ALTER TABLE tbl_name MODIFY col_name {CHAR | VARCHAR | TEXT} (col_length) [CHARACTER SET charset_name] [COLLATE collation_name]

ALTER TABLE `t_app` MODIFY `language` VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci;

ALTER TABLE `t_app` CHANGE `language` `language` VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;

版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/02/26/mysql-modify-encoding/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
打赏
海报
MySQL修改编码
修改数据库编码 ALTER DATABASE db_name [[DEFAULT] CHARACTER SET charset_name] [[DEFAULT] COLLATE collation_name] ALTER DATABASE appblog CHARACTER SE……
<<上一篇
下一篇>>
文章目录
关闭
目 录