macbook - mac 中 mysql 中文乱码问题
问题描述
问题如下:mac 系统版本 10.12.2 mysql 数据版本 5.6.35-macos10.12-x86_64
现在已经在/etc/my.cnf 中添加utf8编码
# For advice on how to change settings please see# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html# *** DO NOT EDIT THIS FILE. It’s a template which will be copied to the# *** default location during install, and will be replaced if you# *** upgrade to a newer version of MySQL.[mysqld] character-set-server=utf8# Remove leading # and set to the amount of RAM for the most important data# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.# innodb_buffer_pool_size = 128M# Remove leading # to turn on a very important data integrity option: logging# changes to the binary log between backups.# log_bin# These are commonly set, remove the # and set as required.# basedir = .....# datadir = .....# port = .....# server_id = .....# socket = .....[client] default-character-set=utf8
终端查询字符编码如下:
终端查询中已经设置成为utf8 编码
navicat 中查询
终端查询带有中文的数据表
IDE 中 java 查询数据表
现在问题是 能在navicat 中能够查询中文。 在mac终端和java中查询都是乱码。 ,求解决。。。。。。。
问题解答
回答1:已经找到问题所在,就是因为在navicat批量导入sql文件得的时候,mac系统中的navicat会自动把编码变为default(latin1) ,所以在navicat中看到是正常的中文,而由于在mac终端以及java 设置的编码都是utf8,所以就产生了乱码。以后导入sql数据时候需要注意一下!!!
相关文章:
1. android - 微信这个效果是怎么实现的2. html5 - chrome下的a标签download属性无法调出另存为的下载框3. javascript - html静态网页,这个轮播图的左右按键可以去掉黑边吗,没找到怎什么地方调呀?4. 自学,刚编了helloworld就失败了5. 为啥最大化个窗口还得找一堆理由?6. javascript - 我的站点貌似被别人克隆了, google 搜索特定文章,除了域名不一样,其他的都一样,如何解决?7. javascript - 在react中写行间样式的whiteSpace不生效8. javascript - jquery对象被定义成jquery变量后,怎么使用:gt这个(可能表达有问题)9. javascript - 求助一个关于indexedDB的问题10. python3.x - mongodb 显示不出中文,都是方块,该如何解决?

网公网安备