真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

怎么在Ubuntu中修改mysql默認(rèn)編碼

今天就跟大家聊聊有關(guān)怎么在Ubuntu中修改MySQL默認(rèn)編碼,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。

創(chuàng)新互聯(lián)建站是一家專業(yè)提供西鄉(xiāng)塘企業(yè)網(wǎng)站建設(shè),專注與成都網(wǎng)站設(shè)計、做網(wǎng)站、成都外貿(mào)網(wǎng)站建設(shè)公司、H5開發(fā)、小程序制作等業(yè)務(wù)。10年已為西鄉(xiāng)塘眾多企業(yè)、政府機(jī)構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)網(wǎng)站制作公司優(yōu)惠進(jìn)行中。

修改mysql的配置文件,使數(shù)據(jù)庫與服務(wù)器操作系統(tǒng)的字符集設(shè)置一致。
    vi /etc/my.cnf 設(shè)置(如果沒有發(fā)現(xiàn)這個文件,就新建1個)
    [mysqld]
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    default-character-set=utf8  (增加的關(guān)鍵一句,使得數(shù)據(jù)庫缺省以utf8存儲)
    當(dāng)然,修改后,要重啟數(shù)據(jù)庫。
   
    再次用mysql -u root -p命令進(jìn)入數(shù)據(jù)庫系統(tǒng),用SHOW VARIABLES LIKE 'character_set_%';命令查看到如下內(nèi)容:
+--------------------------+-----------------------------------------------------------------------+
| Variable_name            | Value                                                                 |
+--------------------------+-----------------------------------------------------------------------+
| character_set_client     | latin1                                                                |
| character_set_connection | latin1                                                                |
| character_set_database   | utf8                                                                  |
| character_set_filesystem | binary                                                                |
| character_set_results    | latin1                                                                |
| character_set_server     | utf8                                                                  |
| character_set_system     | utf8                                                                  |
| character_sets_dir       | /usr/local/mysql-5.1.20-beta-linux-i686-glibc23/share/mysql/charsets/ |
+--------------------------+-----------------------------------------------------------------------+
    發(fā)現(xiàn)關(guān)鍵項目已經(jīng)用了utf8,但這樣還不夠,還要保證客戶端也是用utf8的字符集來操作的。
    登錄的時候,要用以下命令:mysql --default-character-set=utf8 -u root -p
  
    再次用SHOW VARIABLES LIKE 'character_set_%';命令查看,結(jié)果變成了:
+--------------------------+-----------------------------------------------------------------------+
| Variable_name            | Value                                                                 |
+--------------------------+-----------------------------------------------------------------------+
| character_set_client     | utf8                                                                  |
| character_set_connection | utf8                                                                  |
| character_set_database   | utf8                                                                  |
| character_set_filesystem | binary                                                                |
| character_set_results    | utf8                                                                  |
| character_set_server     | utf8                                                                  |
| character_set_system     | utf8                                                                  |
| character_sets_dir       | /usr/local/mysql-5.1.20-beta-linux-i686-glibc23/share/mysql/charsets/ |
+--------------------------+-----------------------------------------------------------------------+

看完上述內(nèi)容,你們對怎么在Ubuntu中修改mysql默認(rèn)編碼有進(jìn)一步的了解嗎?如果還想了解更多知識或者相關(guān)內(nèi)容,請關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝大家的支持。


標(biāo)題名稱:怎么在Ubuntu中修改mysql默認(rèn)編碼
分享URL:http://weahome.cn/article/psdidi.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部