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. angular.js - 輸入郵箱地址之后, 如何使其自動在末尾添加分號?2. javascript - JS 里面的 delete object.key 到底刪除了什么?3. mysql - 電商如何存儲營業額數據4. javascript - 后臺管理系統左側折疊導航欄數據較多,怎么樣直接通過搜索去定位到具體某一個菜單項位置,并展開當前菜單5. 管理員信息修改時的密碼問題6. android - RxJava 中有根據條件執行不同函數的操作符嗎?7. javascript - html5的data屬性怎么指定一個function函數呢?8. java如何生成token?9. javascript - 如何使用nodejs 將.html 文件轉化成canvas10. html5 - 為什么使使用vue cli 腳手架,post-css 沒有自動對css3屬性自動添加瀏覽器前綴呢?
