日期:2014-05-16  浏览次数:20676 次

navicat 显示乱码问题

关于navicat 显示乱码问题 导入导出乱码解决方案

?

今天数据移植换了个navicat版本,,不知道怎么搞的数据插入乱码,真晕。多次尝试终于搞定了

?

特将方法记录如下:

在“连接属性”的设置中,高级-“使用mysql字符集”去掉钩,并且将编码改为10008-GB2312.

然后进入navicat的控制台后,show variables like 'char%';命令后如下:

+--------------------------+---------------------------------------+
| Variable_name??????????? | Value???????????????????????????????? |
+--------------------------+---------------------------------------+
| character_set_client???? | latin1??????????????????????????????? |
| character_set_connection | latin1??????????????????????????????? |
| character_set_database?? | utf8????????????????????????????????? |
| character_set_filesystem | binary??????????????????????????????? |
| character_set_results??? | latin1??????????????????????????????? |
| character_set_server???? | utf8????????????????????????????????? |
| character_set_system???? | utf8????????????????????????????????? |
| character_sets_dir?????? | D:\mysql-5.1.32-win32\share\charsets\ |

?

此时我们需要在控制台运行 set names 'gbk'命令,运行后再次show variables like 'char%';命令查看结果如下:

?

+--------------------------+---------------------------------------+
| Variable_name??????????? | Value???????????????????????????????? |
+--------------------------+---------------------------------------+
| character_set_client???? | gbk?????????????????????????????????? |
| character_set_connection | gbk?????????????????????????????????? |
| character_set_database?? | utf8????????????????????????????????? |
| character_set_filesystem | binary??????????????????????????????? |
| character_set_results??? | gbk?????????????????????????????????? |
| character_set_server???? | utf8????????????????????????????????? |
| character_set_system???? | utf8????????????????????????????????? |
| character_sets_dir?????? | D:\mysql-5.1.32-win32\share\charsets\ |

?

客户端连接环境设置算是完成了。接着中文数据该怎么插还是怎么插,不会再有乱码出现。

?

至于从.sql.txt等文本批量导入数据,则需要将相应的文件转化为gbk格式保存再导入,否则导入后会乱码

?

切记: 去掉“使用mysql字符集”前的钩的同时, 一定要将navicat中的编码 改为 GB2312 仅仅去掉“使用mysql字符集”前的钩没用。

?