sql 如何在MySQL 5.5中将utf8mb4表转换为utf8

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql 如何在MySQL 5.5中将utf8mb4表转换为utf8相关的知识,希望对你有一定的参考价值。

# for Database
ALTER DATABASE databasename CHARACTER SET utf8 COLLATE utf8_unicode_ci;

# for each table
ALTER TABLE tablename CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE wp_commentmeta CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE wp_comments CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE wp_links CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE wp_options CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE wp_postmeta CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE wp_posts CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE wp_termmeta CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE wp_terms CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE wp_term_relationships CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE wp_term_taxonomy CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE wp_usermeta CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE wp_users CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;

以上是关于sql 如何在MySQL 5.5中将utf8mb4表转换为utf8的主要内容,如果未能解决你的问题,请参考以下文章

MySQL 5.5 连接器/J 字符集编码 (utf8mb4) 问题

mysql 5.5 数据库 utf8改utf8mb4

如何在mysql数据库中鎒moji特殊字符

如何在mysql 5.5.x中将character_set_client更新为utf8mb4

如何在 laravel 5.5 迁移中将 DB::unprepared() 用于 mysql 函数和存储过程

更改MySQL数据库的编码为utf8mb4