版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq78442761/article/details/89186738
比如把XX厂家的数据库导出sql语句后,导入到mysql可能会出现中文乱码的问题,如下图所示:
下面来说明下,解决这个问题!
首先修改Mysql库的编码(在中国基本上使用GBK编码):
然后在导入的SQL文件中添加如下:
在创表之前添加:
set character set gbk;
在每个表创建结束后添加:
DEFAULT CHARSET=gbk
如下这个例子:
set character set gbk;
drop table if exists xxxx;
create table xxxx (id bigint(20) not null,code varchar(32),name varchar(64) not null) DEFAULT CHARSET=gbk;
乱码问题即可解决