MySQL使用cmd查詢 中文亂碼,mysqlcmd查詢亂碼

來源:互聯網
上載者:User

MySQL使用cmd查詢 中文亂碼,mysqlcmd查詢亂碼

CMD查看MYSQL資料庫表的時候發現,無法插入中文資料,查出來的中文也都是亂碼。

方法:在mysql安裝檔案裡找到my.ini檔案,添加:default-character-set=utf8

修改以後的效果如下:

[client]
port=3306
default-character-set=utf8
[mysql]
default-character-set=utf8


修改好以後通過cmd登陸mysql :mysql -u root -p

查看編碼格式:show variables like "%char%";

改變資料庫原有的編碼格式:

set character_set_database=utf8;

set character_set_server=utf8;

set character_set_client=utf8;

set character_set_connection=gbk;

set character_set_results=gbk;






相關文章

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.