批量设置mysql表编码

2022-05-25 20:17
254
0
添加收藏
 
1、生成修改代码
#生成修改代码 SELECT CONCAT('ALTER TABLE ', table_name, ' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;') FROM information_schema.TABLES WHERE TABLE_SCHEMA = '数据库名称'
 
2、执行生成的修改代码
 

ALTER TABLE business_xx1 CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

 ALTER TABLE business_xx2 CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; 

全部评论