關於 PHP, Linux, Open Source 及個人生活記載的網誌。
RSS icon
  • MySQL 資料庫轉換: 4.1 to 4.0

    Posted on February 11th, 2006 Sam Tang 2 comments

    MySQL 4.1 的資料表格式相比起 4.0 增加了 character set 的資料,所以如果當編碼設定錯誤的話,很多時雙字節文字 (例如中文字) 便會出現亂碼,或者 ??? 等符號。今天我要想將儲存在 MySQL 4.1 的資料庫複製到 MySQL 4.0,單是使用 mysqldump 便會出現 sql 語法錯誤及亂碼情況,用 phpadmyadmin 也是相同結果,後來找到在 export SQL 檔時需要用 compatible 指定是那一種版本:

    shell> mysqldump –create-options –compatible=mysql40 db_name > dump_file

    然後在 MySQL 4.0 裡面只要像以前一樣就可以了:

    mysql db_name < dump_file
    總算成功轉換了,但原來只怪自己懶,在轉換資料庫後下載了新版的 phpmyadmin 回來,發覺新版 phpmyadmin 的 export 功能已經有 "SQL export compatibility" 可以設定資料庫。


     

    2 responses to “MySQL 資料庫轉換: 4.1 to 4.0”

    1. 【了解】MySQL 資料庫轉換: 4.1 to 4.0

      http://www.real-blog.com/linux-bsd-notes/66原來 phpmyadmin 就有輸出相容性選項了,沒注意到uplookMySQL 4.1 的資料表格式相比起 4.0 增加了 character set 的資料,所以如果當編碼設定錯誤的話,很多時雙字節…

    2. 剛好也遇到新的網存公司的mysql是4.0而舊的網存的mysql是4.1
      資料導入一直錯誤.是不是可以請大大解說詳細一點…
      初學者的我真的是不知如何是好….

      新網存:
      MySQL 版本 4.0.16
      phpMyAdmin 2.7.0-pl2

      舊網存:
      MySQL – 4.1.11-Debian_4sarge5-log
      phpMyAdmin – 2.8.2.1

    Leave a reply

    *
    To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
    Click to hear an audio file of the anti-spam word