MySQL刷庫指令碼中帶中文

來源:互聯網
上載者:User

MySQL刷庫指令碼中帶中文,用MySQL命令登入後刷入資料庫後,讀取出來出現亂碼。

出現的情況有可能是下面的原因:

安裝完MySQL沒有修改用戶端串連編碼,預設是latin1,用MySQL命令登入進去直接source,導致刷進去的資料是latin1編碼的。

解決方案:

1.MySQL命令登入時加參數

mysql --default-character-set=utf8 -u XXX -pXXX  

2.修改my.cnf(目錄在/etc/my.cnf),在[client]增加如下代碼

default-character-set = utf8  

 

 

 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.