Home  >  Article  >  Database  >  mysql插入中文字符串乱码显示???_MySQL

mysql插入中文字符串乱码显示???_MySQL

WBOY
WBOYOriginal
2016-06-01 13:09:531021browse

对于mysql中文出现乱码解决方法:

1.mysql在建库的时候要确保编码方式为utf-8

2.数据库连接的url要设置编码方式为utf-8

如果数据库的驱动以及url等配置信息放在properties文件中如下设置:database.url=jdbc:mysql://127.0.0.1:3306dbname?useUnicode=true&characterEncoding=utf8

如果直接在xml文件中进行配置,设置如下:<property name="url" value="jdbc:mysql://127.0.0.1:3306/dbname?useunicode=true&characterEncoding=utf8"></property>


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn