修改数据表字段的字符集
alter table `W` modify column `CONTENT` varchar(30) character set utf8 not null;
修改数据表的字符集
alter table `W` default character set utf8;或ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
修改数据库的字符集
alter database dbname character set utf8;
在创建表的时候设置表的字符集和列的排序规则(collation)
create table utf ( id int ) default charset=utf8 default collate=utf8_bin;
在创建数据库的时候设置表的字符集和列的排序规则(collation)
create database dbname DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
永久修改数据库字符集
[mysql]
no-auto-rehash
default_character_set=utf8
# The MySQL server
[mysqld]
character_set_server=utf8
[client]
default_character_set=utf8
#password = your_password