Menu:

Recent Entries

About

Sirius

板工秀勇與阿吉管理中

Categories

FreeNX [1]
有關模板 [4]
Ubuntu相關 [1]
硬體相關 [2]
學用Blog [2]
MySQL [4]
Lifetype系統更新 [10]
TinyMCE [3]
xoops [5]
校務系統 [3]
Windows相關 [5]
IMageMagick [1]
XPress [1]
系統修改 [3]
站務公告 [7]
Plugins套用修改 [3]
Moodle [1]
LightBox [1]
CSS [1]
設備使用 [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 . 迴響: (4109). 引用:(147). 靜態連結網址
«Next post | Previous post»

Comments

  1. 1. Home Windows  |  01/22,2022 at 21:48

    Do you have a spam problem on this blog; I also am a blogger, and I was wondering your situation; many of us have created some nice methods and
    we are looking to trade methods with others, please
    shoot me an email if interested.

  2. 2. 슬롯사이트추스핀카지노  |  01/22,2022 at 17:29

    Thank you for some other informative website. Where else could I get that type of
    information written in such a perfect approach? I have a project that
    I am simply now running on, and I have been on the look out
    for such info.

  3. 3. taxi nice aeroport limone piemonte  |  01/22,2022 at 16:40

    I savor, cause I found exactly what I was taking a
    look for. You've ended my four day long hunt! God Bless you man. Have a great day.
    Bye

  4. 4. udaipur  |  01/22,2022 at 16:31

    A person essentially assist to make seriously posts I'd state.
    That is the first time I frequented your web page and thus far?
    I surprised with the analysis you made to
    make this particular publish amazing. Magnificent job!

  5. 5. joker 123  |  01/22,2022 at 13:56

    Helpful info. Lucky me I found your website by chance, and I'm surprised
    why this accident did not took place earlier! I bookmarked it.

  6. 6. Rupiah 138 Login  |  01/22,2022 at 13:09

    This paragraph will assist the internet visitors for creating new
    weblog or even a weblog from start to end.

  7. 7. 유흥알바사이트  |  01/22,2022 at 13:08

    Hi, I log on to your blog regularly. Your writing
    style is witty, keep it up!

  8. 8. Florene  |  01/22,2022 at 10:34

    Thanks to my father who informed me about this weblog, this website is really amazing.

  9. 9. slot gacor malam ini  |  01/22,2022 at 10:21

    Hello! This post could not be written any
    better! Reading through this post reminds me of my good old room mate!
    He always kept chatting about this. I will forward this write-up to him.
    Fairly certain he will have a good read. Thanks for sharing!

  10. 10. endo nord  |  01/22,2022 at 08:17

    My relatives always say that I am wasting my time here at net,
    however I know I am getting familiarity every day by reading thes pleasant articles
    or reviews.

  11. 11. chaturbatei  |  01/22,2022 at 03:36

    Wow, awesome blog layout! How long have you been blogging for?

    you make blogging look easy. The overall look of your site is wonderful, let alone the content!

  12. 12. www.dasversunkenedorf.com  |  01/22,2022 at 01:48

    Do you have a spam problem on this blog; I also am a
    blogger, and I was wondering your situation; many of us have developed some nice methods and we are looking to
    exchange methods with other folks, why not shoot me an email if interested.

  13. 13. pistis.Com.Ng  |  01/21,2022 at 14:54

    What's up mates, its great piece of writing on the topic of tutoringand completely explained, keep it up all the
    time.

  14. 14. Selena  |  01/21,2022 at 14:45

    Useful information. Fortunate me I discovered your website by accident, and I am stunned why this coincidence didn't came about
    earlier! I bookmarked it.

  15. 15. fb88  |  01/21,2022 at 14:25

    My partner and I stumbled over here coming from a different website and thought I should check things out.

    I like what I see so now i am following you. Look forward to checking out your web page yet again.

  16. 16. Lora  |  01/21,2022 at 09:26

    It's genuinely very difficult in this busy life to
    listen news on Television, therefore I only use the web for that reason, and take the
    most recent news.

  17. 17. kampus terbaik di Lampung  |  01/21,2022 at 09:07

    Thank you for the auspicious writeup. It if truth be told used to
    be a enjoyment account it. Look complex to more brought agreeable from you!
    By the way, how can we keep in touch?

  18. 18. 1xbet app download for android  |  01/21,2022 at 08:43

    Hi, i think that i saw you visited my website thus
    i came to return the choose?.I'm trying to to find things to enhance my site!I suppose its ok to use
    some of your ideas!!

  19. 19. Water heater replacement in Kansas City  |  01/21,2022 at 08:36

    Hi there i am kavin, its my first occasion to commenting anywhere, when i read
    this article i thought i could also create comment due to this good article.

  20. 20. w88  |  01/21,2022 at 07:39

    This design is steller! You definitely know how to keep a reader
    entertained. Between your wit and your videos, I was almost moved to start my own blog (well, almost...HaHa!) Great job.
    I really loved what you had to say, and more than that, how you presented
    it. Too cool!

Leave a Reply

發表迴響
 authimage