Menu:

Recent Entries

About

Sirius

板工秀勇與阿吉管理中

Categories

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

Comments

  1. 1. Lewabo  |  06/16,2021 at 06:13

    Hi mates, its fantastic paragraph concerning tutoringand completely defined, keep it up all the time.

  2. 2. life quotes  |  06/02,2021 at 16:02

    Thanks for some other informative site. The place else may just
    I get that kind of info written in such a perfect manner?

    I've a project that I'm simply now running on, and I
    have been on the glance out for such information.

  3. 3. http://tinyurl.com/  |  06/02,2021 at 05:03

    Good day! I know this is kinda off topic but I was wondering if you knew where I could get a captcha
    plugin for my comment form? I'm using the same blog platform as
    yours and I'm having difficulty finding one? Thanks
    a lot!

  4. 4. tinyurl.com  |  06/02,2021 at 00:15

    Howdy! Do you know if they make any plugins to help with Search Engine Optimization?
    I'm trying to get my blog to rank for some targeted keywords but I'm not seeing very good results.

    If you know of any please share. Thank you!

  5. 5. your dating sites  |  06/01,2021 at 12:12

    This is really interesting, You are a very skilled blogger.

    I have joined your feed and look forward to seeking more of your great post.
    Also, I have shared your website in my social networks!

  6. 6. Binary Option Trading​  |  06/01,2021 at 09:58

    Thank you for sharing your info. I really appreciate your efforts and I am waiting for your further write ups thank you once again.

  7. 7. dating sites or  |  06/01,2021 at 00:33

    Howdy would you mind letting me know which
    hosting company you're utilizing? I've loaded your blog in 3 completely
    different web browsers and I must say this blog loads a lot faster
    then most. Can you recommend a good hosting provider
    at a fair price? Many thanks, I appreciate it!

  8. 8. an scoliosis surgery  |  05/31,2021 at 10:42

    It's not my first time to pay a visit this web site, i am browsing this web page dailly and obtain fastidious facts from here all the time.

  9. 9. off scoliosis  |  05/31,2021 at 04:23

    Currently it sounds like Expression Engine is the top blogging platform out there right now.
    (from what I've read) Is that what you're using on your blog?

  10. 10. dating sites for  |  05/30,2021 at 02:23

    It's an amazing article in favor of all the internet people;
    they will obtain advantage from it I am sure.

  11. 11. off dating sites  |  05/29,2021 at 03:46

    I pay a visit everyday some websites and blogs to
    read posts, however this web site offers quality based writing.

  12. 12. investing in digital currency free cryptocurrency trading  |  05/27,2021 at 23:01

    I really like your blog.. very nice colors & theme. Did you make this website
    yourself or did you hire someone to do it for you? Plz answer back as I'm looking to
    construct my own blog and would like to find out where u got this from.
    appreciate it

  13. 13. why dating sites  |  05/26,2021 at 06:56

    I am regular reader, how are you everybody? This paragraph posted at this web page is genuinely fastidious.

  14. 14. was asmr  |  05/21,2021 at 17:36

    Nice blog right here! Additionally your web site lots
    up very fast! What web host are you the usage of? Can I get your associate hyperlink in your host?

    I desire my web site loaded up as fast as yours lol

  15. 15. https://6869milesoflove.tumblr.com/  |  05/20,2021 at 19:45

    free dating sites
    Hello there, You have done a great job. I'll certainly digg it and personally recommend to my friends.
    I'm sure they will be benefited from this website. dating sites

  16. 16. bit.ly  |  05/19,2021 at 21:48

    scoliosis
    Hmm is anyone else having problems with the images
    on this blog loading? I'm trying to determine if its a problem
    on my end or if it's the blog. Any suggestions would be greatly appreciated.
    scoliosis

  17. 17. http://j.mp/3eVCPos  |  05/18,2021 at 03:18

    scoliosis
    Thanks for another great post. The place else may just anybody get that type of information in such an ideal approach of
    writing? I've a presentation next week, and I'm at the search for such info.
    scoliosis

  18. 18. www.reddit.com  |  05/17,2021 at 15:34

    scoliosis
    I just like the valuable info you supply
    on your articles. I'll bookmark your blog and take a look at once more
    right here regularly. I'm relatively certain I will learn many new stuff proper right here!

    Good luck for the following! scoliosis

  19. 19. http://bit.ly/3uT6S5F  |  05/16,2021 at 18:29

    scoliosis
    Why users still make use of to read news papers when in this technological globe everything is presented on web?

    scoliosis

  20. 20. http://bitly.com/  |  05/15,2021 at 16:29

    scoliosis
    of course like your website however you need to take a look
    at the spelling on several of your posts. Many of them are rife with spelling issues and I in finding it very troublesome to inform the reality then again I'll surely
    come back again. scoliosis

Leave a Reply

發表迴響
 authimage