Menu:

Recent Entries

About

Sirius

板工秀勇與阿吉管理中

Categories

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

Comments

  1. 1. binary options platform  |  04/08,2021 at 23:50

    Amazing! This blog looks exactly like my old one! It's on a completely different subject but it has pretty much the same layout
    and design. Outstanding choice of colors!

  2. 2. 0mniartist  |  04/08,2021 at 11:31

    I think the admin of this site is truly working hard for his web site, as here every information is quality based information.
    asmr 0mniartist

  3. 3. Woodcutter strategy  |  04/08,2021 at 10:53

    I am not sure where you are getting your info, but good topic.

    I needs to spend some time learning more or understanding more.
    Thanks for wonderful info I was looking for this info for
    my mission.

  4. 4. binary trading  |  04/07,2021 at 04:36

    Appreciate the recommendation. Will try it out.

  5. 5. strategy for beginners trading  |  04/07,2021 at 03:41

    Appreciation to my father who informed me concerning this web
    site, this blog is really awesome.

  6. 6. binary options software  |  04/06,2021 at 09:09

    Remarkable issues here. I am very happy to look your post.
    Thanks a lot and I am taking a look forward to touch you.
    Will you kindly drop me a mail?

  7. 7. reliable strategy for binary options  |  04/02,2021 at 13:43

    Heya i'm for the first time here. I came across this board and I find It
    really useful & it helped me out a lot. I hope to give something back and aid others like
    you aided me.

  8. 8. fix broken tv screen  |  04/02,2021 at 09:42

    Right away I am going to do my breakfast, when having my breakfast coming over again to read further news.

  9. 9. strategy for binomo  |  04/01,2021 at 23:46

    Do you mind if I quote a couple of your posts as long
    as I provide credit and sources back to your webpage?
    My blog is in the very same niche as yours and my users would truly benefit
    from some of the information you present here. Please
    let me know if this okay with you. Appreciate it!

  10. 10. forex indicators mt4  |  04/01,2021 at 11:01

    hello!,I love your writing very so much! percentage we communicate
    extra about your post on AOL? I need an expert on this area to solve my
    problem. May be that's you! Having a look ahead to look you.

  11. 11. extension vfxalert  |  03/31,2021 at 17:34

    It's amazing to pay a quick visit this web site and reading the views of all mates
    concerning this article, while I am also keen of getting
    familiarity.

  12. 12. binary trades signals  |  03/26,2021 at 19:50

    It is perfect time to make some plans for the future and it is time to be happy.
    I have read this post and if I could I want to suggest
    you few interesting things or advice. Perhaps you could write next articles referring to this article.
    I desire to read more things about it!

  13. 13. eye creams dark circles  |  03/26,2021 at 04:13

    I constantly spent my half an hour to read this weblog's
    articles or reviews daily along with a cup of coffee.

  14. 14. flawless ultra matte avon topscosmetics.uk  |  03/26,2021 at 04:12

    Hello there! I simply wish to offer you a huge thumbs up for your excellent information you have got right here on this post.
    I am coming back to your website for more soon.

  15. 15. anew clinical defend and repair  |  03/26,2021 at 04:04

    Wonderful post! We will be linking to this
    great article on our site. Keep up the great writing.

  16. 16. forex trend indicators  |  03/25,2021 at 21:39

    Wow, superb blog layout! How long have you been blogging for?
    you make blogging look easy. The overall look of your site is excellent, let alone the content!

  17. 17. cryptocurrency trading strategy  |  03/25,2021 at 01:15

    I love it when folks come together and share ideas.
    Great site, continue the good work!

  18. 18. medium.com  |  03/17,2021 at 05:33

    Hi friends, nice paragraph and fastidious urging
    commented here, I am really enjoying by these.

  19. 19. Orb pendant’S light  |  03/15,2021 at 15:05

    Very great post. I simply stumbled upon your blog and wished to mention that I
    have really loved surfing around your weblog posts. After all I'll
    be subscribing for your feed and I am hoping you write once more very soon!

  20. 20. dịch vụ xây nhà trọn gói  |  02/28,2021 at 19:05

    Hey very interesting blog!

Leave a Reply

發表迴響
 authimage