如何修改mysql 5.6.24解壓縮版(免安裝版或zip版)字元編碼,mysql5.6.24

來源:互聯網
上載者:User

如何修改mysql 5.6.24解壓縮版(免安裝版或zip版)字元編碼,mysql5.6.24

 

【今天為瞭解決這個字元預設編碼的問題花費了將近3個小時。由於版本不同,網上給出的修改方式不盡適用於此版本。特將該版本修改字元編碼方式記錄如下,以供他人蔘考】

1、

當我們把zip檔案格式解壓到指定目錄後,並且完成基本環境配置後,開啟mysql 5.6.24會發現名為【my-default.ini】的檔案。我們用記事本開啟該檔案會發現並沒有【default-character-set = xxx】或者【character_set_server=xxx】,怎麼回事呢?網上給出的許多方法都是直接修改這句話的xxx為utf8,不急,下面請看第二步:

2、

複製該檔案,並且命名為【my.ini】,這樣根目錄下就有兩個.ini檔案了,一個是my-default.ini,一個是my.ini 。接下來我們只需修改my.ini裡面的內容就行了。請看第三步:

3、

修改【my.ini】,

在[mysqld]下面添加 character_set_server=utf8,注意是【utf8】不是【utf-8】而且後面沒有任何標點符號;

在【sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES】這句話後面再添加三行:

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

4、

經過以上三步就ok了。儲存後重啟伺服器,登陸後在命令列輸入:【show variables like 'char%';】可查看預設字元集如所示:

5、

我的【my.ini】代碼,紅色代碼區為修改之處:

# 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]

# 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 = D:\mysql-5.6.24-winx64
datadir = D:\mysql-5.6.24-winx64\data
port = 3306
# server_id = .....
character_set_server=utf8

# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[client]
port=3306
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.