Menu:

Recent Entries

About

Sirius

板工秀勇與阿吉管理中

Categories

有關模板 [4]
TinyMCE [3]
Ubuntu相關 [1]
FreeNX [1]
校務系統 [3]
硬體相關 [2]
xoops [5]
系統修改 [4]
LightBox [1]
MySQL [4]
學用Blog [2]
Lifetype系統更新 [10]
IMageMagick [1]
Windows相關 [5]
XPress [1]
CSS [1]
站務公告 [7]
Plugins套用修改 [3]
設備使用 [1]
Moodle [1]
電腦教室管理 [0]

Links

LiftType教學
- LifeType 線上教學(官網)
- 部落格教室(怡杰老師)
- 阿欣部落
- 阿杰老師部落格教室

Syndicate

RSS 0.90
RSS 1.0
RSS 2.0
Atom 0.3

Version:

andreas01 v1.3

[引用]:升級MySQL 4.1

sirius | 19 九月, 2007 05:51

這篇升級MySQL 4.1簡單扼要,可以拿來實做看看。

本文章引用自:避開編碼問題升級MySQL 4.1

MySQL4.1不向下相容,最主要的原因就是他在語系編碼的支援上大幅度的進步,但是剛裝起來的人一定都覺得奇怪,為什麼會跑出一堆亂碼,我昨天經過一整晚的折騰後,終於把問題解決了,最主要的原因是他預設的語言編碼是latin1。另外,這篇是以UTF-8編碼的資料為範例,Big5應該也可以,不過我沒測試過,想測試的人就把文章中一些編碼的參數改成Big5應該就可以了。還有我的環境是Windows XP。



既然這篇要講的是升級問題,當然有個步驟,首先在升級之前,備份的你的資料庫,這點很重要,當你即使照著我的方法還是失敗時,你還有一條退路,而且將資料輸出成sql檔案也是我的升級步驟一。備份資料的方法有三個,如果有裝phpMyadmin,可以直接用他的匯出功能輸出sql檔案,記得不要只輸出結構,資料也要輸出。另一個方法是用mysqldump,檔案在mysql安裝目錄的bin子目錄裡面,你必須進入指令列模式(DOS視窗)才可以正確的操作該程式,要備份所有的資料庫,你可以輸入mysqldump --all-databases > all_databases.sql,這樣會把所有的資料都輸出到all_databases.sql這個檔案,檔案位置應該就是在bin裡面,如果有另外指定就看你指定到哪了。如果只要複製其中幾個資料庫則是用mysqldump --databases db_name1 db_name2 > databases.sql這樣的指令,db_name的部分就看你要匯出哪些資料庫。第三個方法是直接把mysql下的data子目錄的檔案都備份下來,但是這樣並不會有後面需要用的sql檔案,如果你用這個方法備份資料庫,你還是需要用前面兩個方法的其中一個來取得sql檔案。



備份完資料庫,取得sql檔案後,最好先用文字編輯軟體打開他,確定有沒有亂碼,如果你原先的資料不是UTF-8的話,可以趁這個機會用其他程式把sql檔案轉成UTF-8,這個檔案的編碼就是你後面設定mysql要用的編碼了。



接下來就可以安裝MySQL 4.1了,這部分可以用他的安裝檔,或用他的免安裝版都可以,只要確定能執行就可以。安裝完之後,我們要來修改my.ini這個檔案,這個檔案有可能在windows目錄裡面,也可能在mysql目錄裡面,如果不存在的話,你就必須要自己建立一個。如果已經存在的話,用文字編輯軟體打開來應該可以看到一些設定,我們要加設定的地方有四個,分別是[mysql]、[mysqld]、[client]、[mysqldump]四個地方,都在裡面加入default-character-set = utf8這個設定,如果沒有的話,你可以簡單建立一個內容如下的my.ini檔案:

[mysqld]
default-character-set = utf8

[mysqldump]
default-character-set = utf8

[mysql]
default-character-set = utf8

[client]
default-character-set = utf8

檔案是放到windows目錄下比較保險,我自己用無安裝版是要放到那才會讀到,雖然好像可以調整位置,但是我還沒測試成功。OK之後重新啟動mysql,如果是直接安裝升級的話可能會有資料已經存在了,不過選取出來看應該會是亂碼,這時候你可以先手動刪除,或是你用phpMyadmin輸出的sql檔會先把重複的資料庫刪除(有選項可以勾選),那你也可以不用理會它,再來就是最後一步了,把你匯出的sql檔放回去,我是用phpMyAdmin來做這件事,發法是先隨便選一個資料庫(新安裝的也有預建好的test資料庫可以選),然後選擇sql這個選項,下面的文字檔案的位置處把你的sql檔案上傳,編碼選正確,然後送出就可以了。另外還可以用mysqldump,指令:mysqldump db_name < database.sql,不過這個方式我沒測試過,而且看說明檔提供的範例指令,看起來都是還原單一資料庫,又或許db_name可以隨便給吧。



如果一切順利,現在還原的資料庫編碼就是正確的了,要確認最好的方法是用phpMyAdmin來檢視,因為他有支援MySQL 4.1的編碼功能,只要沒問題,用他來檢視資料就不會有亂碼。雖然資料沒問題,不過原來的程式還要做修改,MovableType算是很簡單的了,我在一個日本網站有看到詳細的說明和解決辦法,iandeth.: Movable Type + MySQL 4.1 を組み合わせると日本語が文字化けする不具合/障害の解決方法:,說明的很詳細,其中解決辦法的部分我想不會日文也可以看的懂,就不多做解釋了(第一個方法只是加一行、不過第二個方法是比較好的解決方法)。



寫了這麼多,基本上不建議貿然升級4.1啦,最後才講好像不好XD。

Posted in MySQL . 迴響: (1103). 引用:(14). 靜態連結網址
«Next post | Previous post»

Comments

  1. 1. slot online indonesia terpercaya  |  09/17,2021 at 00:25

    Its like you read my mind! You appear to know so
    much about this, like you wrote the book in it or something.
    I think that you can do with some pics to drive the message home
    a little bit, but instead of that, this is wonderful blog.
    A great read. I'll certainly be back.

  2. 2. new model homes for sale  |  09/17,2021 at 00:21

    Awesome article.

  3. 3. judi Slot freechip tanpa Deposit  |  09/16,2021 at 21:51

    Saved as a favorite, I love your web site!

  4. 4. 카지노사이트  |  09/16,2021 at 21:43

    Thankfulness to my father who stated to me on the topic
    of this weblog, this webpage is truly remarkable.

  5. 5. Situs Judi Slot Daftar Langsung Dapat Bonus Tanpa Deposit  |  09/16,2021 at 21:42

    Thanks to my father who shared with me regarding this blog,
    this website is actually amazing.

  6. 6. link slot88  |  09/16,2021 at 20:38

    Peculiar article, totally what I needed.

  7. 7. togel Hongkong hari Ini  |  09/16,2021 at 19:38

    Hi! Someone in my Facebook group shared this
    website with us so I came to take a look. I'm definitely
    loving the information. I'm book-marking and will be tweeting this to my followers!
    Outstanding blog and brilliant design and style.

  8. 8. Burnsville home mortgage lender  |  09/16,2021 at 19:05

    These are genuinely impressive ideas in about blogging.
    You have touched some fastidious things here. Any way keep up wrinting.

  9. 9. Japan Sex Tube Online  |  09/16,2021 at 18:27

    Ahaa, its good conversation concerning this piece of writing here at this blog, I have read all that, so now me also commenting
    here.

  10. 10. джинсовая куртка  |  09/16,2021 at 17:35

    Howdy this is kinda of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML.

    I'm starting a blog soon but have no coding
    knowledge so I wanted to get guidance from someone with experience.
    Any help would be enormously appreciated!

  11. 11. poker slot Pulsa Telkomsel  |  09/16,2021 at 17:32

    Heya i'm for the primary time here. I came across
    this board and I in finding It truly helpful & it helped me out a lot.

    I am hoping to present something back and help
    others such as you aided me.

  12. 12. mailbox cover ups  |  09/16,2021 at 17:04

    Keep on working, great job!

  13. 13. Cambridge English  |  09/16,2021 at 15:55

    I like the valuable information you provide in your articles.
    I will bookmark your weblog and check again here frequently.

    I'm quite sure I will learn many new stuff right here!

    Best of luck for the next!

  14. 14. daftar slot terpercaya  |  09/16,2021 at 15:04

    Hi, Neat post. There's an issue together with your site in internet explorer, might test
    this? IE still is the marketplace leader and a huge element
    of other people will leave out your wonderful writing due
    to this problem.

  15. 15. slot88 deposit pulsa  |  09/16,2021 at 12:12

    Currently it looks like Movable Type is the preferred blogging platform available right now.
    (from what I've read) Is that what you're using on your blog?

  16. 16. britney spears beach topless  |  09/16,2021 at 12:01

    Everything is very open with a precise clarification of
    the issues. It was really informative. Your website is
    extremely helpful. Thank you for sharing!

  17. 17. judi slot deposit pakai pulsa indosat  |  09/16,2021 at 11:06

    I always used to study post in news papers but now as
    I am a user of net so from now I am using net
    for articles, thanks to web.

  18. 18. نمایندگی hp  |  09/16,2021 at 09:57

    It's difficult to find knowledgeable people for this subject, but you sound like you know what you're talking about!
    Thanks

  19. 19. สล๊อตออนไลน์  |  09/16,2021 at 09:56

    Pretty element of content. I simply stumbled upon your
    web site and in accession capital to claim that I get actually enjoyed
    account your blog posts. Anyway I'll be subscribing to your augment and even I fulfillment you get admission to constantly quickly. https://www.ufaball777.com

  20. 20. Situs Judi Online  |  09/16,2021 at 09:16

    Hello there! I simply would like to offer you a huge thumbs up for the great info you have here on this post.
    I'll be returning to your blog for more soon.

Leave a Reply

發表迴響
 authimage