mysql乱码问题

来源:互联网 发布:工业控制软件 编辑:程序博客网 时间:2024/05/18 18:45

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

--更改字符集 
SET character_set_client = utf-8 ; 
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;

 

原创粉丝点击