如何将整个 MySQL 数据库字符集转换为 UTF-8 并将排序规则转换为 UTF-8?
How can I convert entire MySQL database character-set to UTF-8 and collation to UTF-8?
使用ALTER DATABASE
和 ALTER TABLE代码> 命令.
ALTER DATABASE databasename CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE tablename CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
或者,如果您仍在使用不支持 4 字节 UTF-8 的 MySQL 5.5.2 或更低版本,请使用 utf8
而不是 utf8mb4
:>
Or if you're still on MySQL 5.5.2 or older which didn't support 4-byte UTF-8, use utf8
instead of utf8mb4
:
ALTER DATABASE databasename CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE tablename CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
这篇关于如何将整个 MySQL 数据库字符集和排序规则转换为 UTF-8?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!