Home > Database > Mysql Tutorial > body text

解决mysql乱码有关问题

WBOY
Release: 2016-06-07 16:15:11
Original
1132 people have browsed it

解决mysql乱码问题 今天再弄hibernate,发现在dos窗口下mysql是乱码的,而取出来的在程序里却没有问题,于是我便设置了一番 在mysl的安装目录下有一个my.ini --------------------------------------------------------- [mysql] default-character-set=utf8

解决mysql乱码问题

今天再弄hibernate,发现在dos窗口下mysql是乱码的,而取出来的在程序里却没有问题,于是我便设置了一番


在mysl的安装目录下有一个my.ini

---------------------------------------------------------

[mysql]

default-character-set=utf8


[mysqld]

default-character-set=utf8

----------------------------------------------------------


以上的便是他的配置文件,请注意这两个default-character-set=utf8,不一样,上边的是我们在dos窗口下显示的格式,下边的是mysql server里默认保存的编码,


于是我修改了他们,以下是修改后


---------------------------------------------------------

[mysql]

default-character-set=gbk


[mysqld]

default-character-set=utf8

----------------------------------------------------------


这样乱码问题就解决了,在mysql server里仍然是utf8格式,而我们看到的就是gbk格式。。。。。。


Related labels:
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