如何更改MySQL表的默认字符集? [英] How to change the default charset of a MySQL table?
本文介绍了如何更改MySQL表的默认字符集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有一个MySQL table
,其定义取自SQLYog Enterprise
:
There is a MySQL table
which has this definition taken from SQLYog Enterprise
:
Table Create Table
----------------- ---------------------------------------------------------
etape_prospection CREATE TABLE `etape_prospection` (
`etape_prosp_id` int(10) NOT NULL AUTO_INCREMENT,
`type_prosp_id` int(10) NOT NULL DEFAULT '0',
`prosp_id` int(10) NOT NULL DEFAULT '0',
`etape_prosp_date` datetime DEFAULT NULL,
`etape_prosp_comment` text,
PRIMARY KEY (`etape_prosp_id`),
KEY `concerne_fk` (`prosp_id`),
KEY `de_type_fk` (`type_prosp_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
我想将此表的default charset
从latin1
更改为utf8
.该怎么做?
I want to change the default charset
of this table from latin1
to utf8
. How to do that ?
推荐答案
如果要将表default character set
和所有字符列更改为新字符集,请使用如下语句:
If you want to change the table default character set
and all character columns to a new character set, use a statement like this:
ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
因此查询将是:
ALTER TABLE etape_prospection CONVERT TO CHARACTER SET utf8;
这篇关于如何更改MySQL表的默认字符集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文