解壓版中文亂碼問題MYSQL中文亂碼

來源:互聯網
上載者:User

標籤:cli   blog   engine   忽略   java   arch   問題   資料庫   建表   

安裝的是解壓版的MYSQL,具體配置參考:https://jingyan.baidu.com/article/9c69d48f85032f13c9024e15.html 。

 

1:解壓之後copy 一個my.ini檔案 然後添加位元組編碼配置:

[client]default-character-set=gbk[mysqld]character-set-server=utf8

 指定資料庫設定檔bin\mysqld --defaults-file=my.ini --initialize-insecure   指定設定檔my.ini(如果忽略這一步驟的話,配置my.ini將不會生效,有點小坑)

安裝資料庫:bin/mysqld --install

啟動資料庫服務:net start mysql (windows環境下)

 

2:建立資料庫時候指定資料庫編碼:

3 建立表時候指定UTF8編碼:

CREATE TABLE `Demo_Table` (  `name` varchar(255) NOT NULL,  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,  `modified_at` timestamp NOT NULL DEFAULT ‘0000-00-00 00:00:00‘ ON UPDATE CURRENT_TIMESTAMP,  `size` bigint(20) DEFAULT NULL,  `type` varchar(255)  DEFAULT NULL,  `label` varchar(255)  DEFAULT NULL,  PRIMARY KEY (`name`,`created_by`)) ENGINE=InnoDB DEFAULT CHARSET=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.