如何更改数据库、表、列的排序规则?

2021-11-20 00:00:00 mysql collation

数据库现在是 latin1_general_ci,我想将排序规则更改为 utf8mb4_general_ci.

The database is latin1_general_ci now and I want to change collation to utf8mb4_general_ci.

PhpMyAdmin 中是否有任何设置可以更改数据库、表、列的排序规则?而不是一一改变?

Is there any setting in PhpMyAdmin to change collation of database, table, column? Rather than changing one by one?

推荐答案

您需要单独转换每个表:

You need to either convert each table individually:

ALTER TABLE mytable CONVERT TO CHARACTER SET utf8mb4 

(这也将转换列),或使用 latin1 导出数据库并使用 utf8mb4 将其导入.

(this will convert the columns just as well), or export the database with latin1 and import it back with utf8mb4.

相关文章