一次如何将排序规则更改为utf8_bin [英] How to change Collation to utf8_bin in one go
本文介绍了一次如何将排序规则更改为utf8_bin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已将所有数据库表的排序规则设置为 latin1_swedish_ci
,现在我意识到我应该使用 utf8_bin
或 utf8_general_ci
。
I have set up the Collation of all my database tables as latin1_swedish_ci
and now I realise that I should use utf8_bin
or utf8_general_ci
.
如何将表中的排序规则更改为 utf8_bin
或 utf8_general_ci
一次?我可以使用查询或者什么吗?
How can I change the Collation in the tables to utf8_bin
or utf8_general_ci
in one go? Can I use a query or something?
推荐答案
您只需要在每个表上运行ALTER,如下所示:
You'll simply need to run an ALTER on each of the tables as follows:
ALTER TABLE <table name> COLLATE utf8_general_ci;
如果您还需要更新现有的字符编码(不太可能发生事情的声音),您可以使用:
If you also need to update the existing character encoding (unlikely by the sounds of things), you can use:
ALTER TABLE <table name> CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
这篇关于一次如何将排序规则更改为utf8_bin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文