Mysql改变了信息模式的列排序和字符集

时间:2022-02-03 00:46:47

I want to change column collation and character set of system database information_schema...

我想更改系统数据库information_schema的列排序和字符集……

Can anyone give any input on how to do this? Is there any special priviledges i need for this

有谁能告诉我该怎么做吗?我需要什么特殊优惠吗

3 个解决方案

#1


10  

As far as I know, you cannot run ALTER TABLE commands on the tables in information_schema. Instead you will probably want to take a look at the character_set_* variabes. You can see which variables are set to which values in your MySQL server with a show variables command:

据我所知,您不能在information_schema的表上运行ALTER TABLE命令。相反,您可能想看看characters _set_* variabes。您可以使用show variables命令查看MySQL服务器中哪些变量设置为哪些值:

show variables like "character_set_%";

The variable that has to do with meta data in MySQL, such as the information_schema tables, is the character_set_system variable. I think the my.cnf is the right place to set it.

与MySQL中的元数据相关的变量,如information_schema表,是character_set_system变量。我认为mycnf是设置它的正确位置。

There's more information on this page: UTF-8 for Metadata.

本页有更多信息:元数据的UTF-8。

For ordinary tables, you change the character set of a table with an ALTER TABLE command:

对于普通表,您可以使用ALTER table命令更改表的字符集:

alter table some_table convert to character set utf8;

To do this, you will need the "alter" privilege.

为此,您将需要“alter”特权。

You can see which privileges your MySQL server supports with a show privileges command, and you can see which privileges are granted to your current user with a show grants command.

您可以通过show privileges命令查看您的MySQL服务器支持哪些特权,您可以看到哪些特权授予您的当前用户,并使用show grant命令。

#2


19  

To change the character set and collation for all columns in an existing table, use:

若要更改现有表中所有列的字符集和排序,请使用:

ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name [COLLATE collation_name];

#3


2  

alter table some_table convert to character set utf8;

awesome that worked great as far as i can tell for me, now i can use chinese in that tables!! and i can remove all the utf8_encode() utf8_decode() throughout my site!

就我所能说的来说,那真是太棒了,现在我可以在那张桌子上用中文了!我可以删除我的网站上所有的utf8_encode() utf8_decode() !

#1


10  

As far as I know, you cannot run ALTER TABLE commands on the tables in information_schema. Instead you will probably want to take a look at the character_set_* variabes. You can see which variables are set to which values in your MySQL server with a show variables command:

据我所知,您不能在information_schema的表上运行ALTER TABLE命令。相反,您可能想看看characters _set_* variabes。您可以使用show variables命令查看MySQL服务器中哪些变量设置为哪些值:

show variables like "character_set_%";

The variable that has to do with meta data in MySQL, such as the information_schema tables, is the character_set_system variable. I think the my.cnf is the right place to set it.

与MySQL中的元数据相关的变量,如information_schema表,是character_set_system变量。我认为mycnf是设置它的正确位置。

There's more information on this page: UTF-8 for Metadata.

本页有更多信息:元数据的UTF-8。

For ordinary tables, you change the character set of a table with an ALTER TABLE command:

对于普通表,您可以使用ALTER table命令更改表的字符集:

alter table some_table convert to character set utf8;

To do this, you will need the "alter" privilege.

为此,您将需要“alter”特权。

You can see which privileges your MySQL server supports with a show privileges command, and you can see which privileges are granted to your current user with a show grants command.

您可以通过show privileges命令查看您的MySQL服务器支持哪些特权,您可以看到哪些特权授予您的当前用户,并使用show grant命令。

#2


19  

To change the character set and collation for all columns in an existing table, use:

若要更改现有表中所有列的字符集和排序,请使用:

ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name [COLLATE collation_name];

#3


2  

alter table some_table convert to character set utf8;

awesome that worked great as far as i can tell for me, now i can use chinese in that tables!! and i can remove all the utf8_encode() utf8_decode() throughout my site!

就我所能说的来说,那真是太棒了,现在我可以在那张桌子上用中文了!我可以删除我的网站上所有的utf8_encode() utf8_decode() !