我正在尝试在db中保存印地语内容,因此我在表格中也对此查询进行了更改
ALTER TABLE group_distribution CHARACTER SET UTF8;
当我运行此查询时
SHOW VARIABLES LIKE 'character_set%';
我得到了以下结果
character_set_client utf8
character_set_connection utf8
character_set_database latin1
character_set_filesystem binary
character_set_results utf8
character_set_server latin1
character_set_system utf8
character_sets_dir /usr/share/mysql/charsets/
我必须做出哪些更改,以便我的数据库支持其他语言?
答案 0 :(得分:0)
我遇到了问题..问题与表格定义有关,见下文
CREATE TABLE `group_distribution` (
`gd_id` int(11) NOT NULL,
`gd_tweet` varchar(500) CHARACTER SET latin1 NOT NULL,
`gd_ht` varchar(45) CHARACTER SET latin1 DEFAULT NULL,
`gt_created_by` int(11) DEFAULT NULL,
`gt_team_lead` int(11) DEFAULT NULL,
`gt_send_to` int(11) DEFAULT NULL,
`gt_added_dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`gt_update_dt` timestamp NULL DEFAULT NULL,
`gt_active_flag` tinyint(1) NOT NULL,
PRIMARY KEY (`gd_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
在这里你可以清楚地看看它显示gd_tweet` varchar(500)CHARACTER SET latin1 NOT NULL,有不同的字符集这就是为什么现在创建问题我把它改成了
CREATE TABLE `group_distribution` (
`gd_id` int(11) NOT NULL,
`gd_tweet` varchar(500) CHARACTER SET utf8 NOT NULL,
`gd_ht` varchar(45) CHARACTER SET utf8 DEFAULT NULL,
`gt_created_by` int(11) DEFAULT NULL,
`gt_team_lead` int(11) DEFAULT NULL,
`gt_send_to` int(11) DEFAULT NULL,
`gt_added_dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`gt_update_dt` timestamp NULL DEFAULT NULL,
`gt_active_flag` tinyint(1) NOT NULL,
PRIMARY KEY (`gd_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
答案 1 :(得分:0)
ALTER TABLE tbl_name CONVERT TO CHARACTER SET utf8;