Home > Database > Mysql Tutorial > body text

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

WBOY
Release: 2016-06-01 13:09:53
Original
1054 people have browsed it

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

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

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

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

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


source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template