MySQL字元編碼設定

來源:互聯網
上載者:User

標籤:mysql

通過show variables like ‘character_set%%‘;查看編碼

修改mysql的編碼方式可以有以下幾個:

1.通過設定檔修改my.ini(windows下)或/etc/my.cnf(linux下)


分別添加如下內容

650) this.width=650;" src="/img/fz.gif" alt="複製代碼" style="margin:0px;padding:0px;border:none;" />

[mysqld]character_server_set=utf8[mysql]default-character-set=utf8[mysql.server]default-character-set=utf8[mysql_safe]default-character-set=utf8[client]default-character-set=utf8

650) this.width=650;" src="/img/fz.gif" alt="複製代碼" style="margin:0px;padding:0px;border:none;" />

2.建立資料庫時設定編碼
create database test character set utf8;
3.建立表時設定編碼
create table test(id int primary key)DEFAULT charset=utf8;
4.修改資料庫編碼
alter database test character set utf8;
5.修改表預設編碼
alter table test character set utf8;
6.修改欄位編碼
alter table test modify col_name varchar(50) CHARACTER SET utf8;


MySQL字元編碼設定

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.