mysql字段注释乱码其他正常

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql字段注释乱码其他正常相关的知识,希望对你有一定的参考价值。

mysql中字段的注释为乱码其他的正常该如何解决?

phpmyadmin 在显示的时候你可以调整显示编码(与数据库安装时默认编码一致时),phpmyadmin查到数据显示的就不是乱码,但phpmyadmin页面显示的是别的鸟文,只有数据是正确显示,所以你导入数据的时候在调整显示编码后再导入,一切都会正常。 参考技术A 应该 用 在server.xml文件里改成 <?xml version='版本号' encoding='utf-8'?> 来解码
就ok了
参考技术B 是因为终端编码和mysql server设置编码不一致造成的 参考技术C SQL脚本文件的问题!修改脚本文件的字符编码即可! 参考技术D 字符集设置错误了

R连接mysql乱码,看清是查询语句在r软件里是正常的,穿到mysql就乱码了,郁闷!!!

好烦~各位童鞋我的乱码不是查询后字符编码不对,是我用RODBC连接mysql后sqlquery()方法里的中文到了mysql里就变成乱码了,我的obdc和r软件都设置了utf8,mysql也设了utf8,啊啊啊啊好烦~~~下面是控制台输出

> print(paste("select building_area,unit_price from sheet1_copy where project = '","万泉寺东里","'",sep = ""));
[1] "select building_area,unit_price from sheet1_copy where project = '万泉寺东里'"
> sqlQuery(channel = channel,paste("select building_area,unit_price from sheet1_copy where project = '","万泉寺东里","'",sep = ""));
[1] "42000 1064 [MySQL][ODBC 5.3(w) Driver][mysqld-5.7.11-log]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''涓囨硥瀵轰笢阅?' at line 1"
[2] "[RODBC] ERROR: Could not SQLExecDirect 'select building_area,unit_price from sheet1_copy where project = '涓囨硥瀵轰笢阅\x8c''"
> sqlQuery(channel = channel,"select building_area,unit_price from sheet1_copy where project = '万泉寺东里'");
[1] "42000 1064 [MySQL][ODBC 5.3(w) Driver][mysqld-5.7.11-log]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''涓囨硥瀵轰笢阅?' at line 1"
[2] "[RODBC] ERROR: Could not SQLExecDirect 'select building_area,unit_price from sheet1_copy where project = '涓囨硥瀵轰笢阅\x8c''"
> sqlQuery(channel = channel,paste("select building_area,unit_price from sheet1_copy where project = '","万泉寺东里","'",sep = ""));
[1] "42000 1064 [MySQL][ODBC 5.3(w) Driver][mysqld-5.7.11-log]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''涓囨硥瀵轰笢阅?' at line 1"
[2] "[RODBC] ERROR: Could not SQLExecDirect 'select building_area,unit_price from sheet1_copy where project = '涓囨硥瀵轰笢阅\x8c''"
> sqlQuery(channel = channel,"select building_area,unit_price from sheet1_copy where project = '万泉寺东里'");
[1] "42000 1064 [MySQL][ODBC 5.3(w) Driver][mysqld-5.7.11-log]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''涓囨硥瀵轰笢阅?' at line 1"
[2] "[RODBC] ERROR: Could not SQLExecDirect 'select building_area,unit_price from sheet1_copy where project = '涓囨硥瀵轰笢阅\x8c''"
>

跪求大神指点啊~~~~~~~~~~~~~~~~~~~~~

参考技术A 编码格式不一样,把程序和mysql编码格式统一起来就可以了追问

我已经说了。。。。odbc,mysql,R,都设置了utf8,你看清楚好么。。。

追答

把字符串单独拿出来转码

String s=new String(“内容”,"utf-8");试试

追问

已经好了,我把R客户端重启了,应该是设置了但是没有及时生效,真是日了狗了。还是谢谢你的帮助。

本回答被提问者采纳

以上是关于mysql字段注释乱码其他正常的主要内容,如果未能解决你的问题,请参考以下文章

idea ssm项目出现日志中文乱码,封装的json中的msg字段中文乱码(但是json封装的bean中的字段不乱码)等其他各种项目下的中文乱码解决方案

Mac下eclipse导入其他工程中文注释出现乱码解决方案

oracle导入表,注释中文变成乱码怎么办?

mysql 字段的注释有啥用

mysql中中文乱码问题

Navicat for MySQL导出excel文件出现中文乱码的问题