mysql乱码问题

show variables like 'character%';查看字符编码


--更改字符集  
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 ;  

SET collation_connection = utf8 ;  
SET collation_database = utf8 ;  
SET collation_server = utf8 ;  
连接数据库时:
jdbc:mysql://localhost:3306/数据库名?useUnicode=true&characterEncoding=utf8
查询之前:
set names gbk;


存中文显示长度太长,但是字段长度够长,说明字符集没设置
C:\Program Files\MySQL\MySQL Server 5.0\my.ini\
default-character-set=utf8
default-character-set=utf8





你可能感兴趣的:(mysql,数据库,jdbc,编码,乱码)