macbook - mac 中 mysql 中文亂碼問(wèn)題
問(wèn)題描述
問(wèn)題如下:mac 系統(tǒng)版本 10.12.2 mysql 數(shù)據(jù)版本 5.6.35-macos10.12-x86_64
現(xiàn)在已經(jīng)在/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
終端查詢字符編碼如下:
終端查詢中已經(jīng)設(shè)置成為utf8 編碼
navicat 中查詢
終端查詢帶有中文的數(shù)據(jù)表
IDE 中 java 查詢數(shù)據(jù)表
現(xiàn)在問(wèn)題是 能在navicat 中能夠查詢中文。 在mac終端和java中查詢都是亂碼。 ,求解決。。。。。。。
問(wèn)題解答
回答1:已經(jīng)找到問(wèn)題所在,就是因?yàn)樵趎avicat批量導(dǎo)入sql文件得的時(shí)候,mac系統(tǒng)中的navicat會(huì)自動(dòng)把編碼變?yōu)閐efault(latin1) ,所以在navicat中看到是正常的中文,而由于在mac終端以及java 設(shè)置的編碼都是utf8,所以就產(chǎn)生了亂碼。以后導(dǎo)入sql數(shù)據(jù)時(shí)候需要注意一下!??!
相關(guān)文章:
1. php多任務(wù)倒計(jì)時(shí)求助2. 數(shù)組排序,并把排序后的值存入到新數(shù)組中3. 默認(rèn)輸出類型為json,如何輸出html4. 怎么能做出標(biāo)簽切換頁(yè)的效果,(文字內(nèi)容隨動(dòng))5. python的正則怎么同時(shí)匹配兩個(gè)不同結(jié)果?6. PHP訂單派單系統(tǒng)7. python中def定義的函數(shù)加括號(hào)和不加括號(hào)的區(qū)別?8. javascript - charles map remote映射問(wèn)題9. mysql - sql 左連接結(jié)果union右連接結(jié)果,導(dǎo)致重復(fù)性計(jì)算怎么解決?10. javascript - 有適合開(kāi)發(fā)手機(jī)端Html5網(wǎng)頁(yè)小游戲的前端框架嗎?
