SET character_set_client = utf8;
SET character_set_connection = utf8;
SET character_set_database = utf8;
SET character_set_results = utf8;
SET character_set_server = utf8;
|character_set_client注意| character_set_connection | utf8 | utf8 | | character_set_database | | utf8 | character_set_filesystem | binary| | character_set_results | | character_set_server | utf8 | | character_set_system | latin1 | | utf8
+--------------------------+---------------------------------------------------------+ | Variable_name另外注意事项:+--------------------------+---------------------------------------------------------+ | character_set_client | Value | | character_set_connection | utf8 | utf8 | | character_set_database | | utf8 | character_set_filesystem | binary| | character_set_results | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | utf8 | +--------------------------+---------------------------------------------------------+ 8 rows in set | C:\Program Files\MySQL\MySQL Server 5.0\share\charsets\ |
1、建表时加utf8,表字段的Collation可加可不加,不加时默认是utf8_general_ci了。
2、网页xxx.php/jsp保存时选择utf8编码,页头最好加上CREATE TABLE `tablename4` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`varchar1` varchar(255) DEFAULT NULL,
`varbinary1` varbinary(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
-------------------------连接数据库设置编码
从我的博客搬来,无法搬家了