当前位置:Gxlcms > 数据库问题 > Mysql 导入日文数据乱码问题

Mysql 导入日文数据乱码问题

时间:2021-07-01 10:21:17 帮助过:6人阅读

|

 

+----------------------+-----------------+

3 rows in set (0.00 sec)

而通过jdbc 的配置制定了连接字符集,所以通过ui设定日文无问题:

jdbc\:mysql\://10.1.0.198\:3306/mytestui?zeroDateTimeBehavior\=convertToNull&useUnicode\=true&characterEncoding\=utf-8

 

而导入数据时,由于没有明确指定连接字符集,mysql会使用默认的字符集进行导入操作,而默认字符集是 latin1_swedish_ci

mysql -h127.0.0.1 -umyaccount -p <./patch.sql

解决方案1:

修改系统的默认字符集为utf-8

解决方案2:

导入sql文件时,指定字符集:

mysql -h127.0.0. -umyaccount -p <.patch.sql --default-character-set=utf8

 

Mysql explain:

Use charset_name as the default character set for the client and connection.
A common issue that can occur when the operating system uses utf8 or another multi-byte character set is that output from the mysql client is formatted incorrectly, due to the fact that the MySQL client uses the latin1 character set by default. You can usually fix such issues by using this option to force the client to use the system character set instead

 

Mysql 导入日文数据乱码问题

标签:

人气教程排行