[系統] MySQL 5.1 / MySQL 3.23 在big5上不相容

看板Database作者 (PP)時間15年前 (2010/12/21 15:21), 編輯推噓3(300)
留言3則, 3人參與, 最新討論串1/8 (看更多)
以下是從編譯為 big5 的 mysql 3.23.58 上抓取的資料 編譯方法: ./configure --prefix=/usr/local/mysql --with-charset=big5 make make install 從 MySQL 3.23 dump 出的資料 (test.txt): INSERT INTO big5_test (test) VALUES ('許功蓋'); INSERT INTO big5_test (test) VALUES ('產量尠 (公斤)'); MySQL 5.1.53 big5 環境: mysql> show variables like "char%"; +--------------------------+-----------------------------+ | Variable_name | Value | +--------------------------+-----------------------------+ | character_set_client | big5 | | character_set_connection | big5 | | character_set_database | big5 | | character_set_filesystem | binary | | character_set_results | big5 | | character_set_server | big5 | | character_set_system | utf8 | | character_sets_dir | C:\MySQL5.1\share\charsets\ | +--------------------------+-----------------------------+ 8 rows in set (0.02 sec) 錯誤訊息: C:\MySQL5.1\bin>mysql -u root test <./test.txt ERROR 1366 (HY000) at line 2: Incorrect string value: '\xFB\xF3 (\xA4\xBD...' for column 'test' at row 1 MySQL 5.1.53 latin1 環境 mysql> show variables like "char%"; +--------------------------+-----------------------------+ | Variable_name | Value | +--------------------------+-----------------------------+ | character_set_client | latin1 | | character_set_connection | latin1 | | character_set_database | latin1 | | character_set_filesystem | binary | | character_set_results | latin1 | | character_set_server | latin1 | | character_set_system | utf8 | | character_sets_dir | C:\MySQL5.1\share\charsets\ | +--------------------------+-----------------------------+ 8 rows in set (0.00 sec) C:\MySQL5.1\bin>mysql -u root test <./test.txt ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '產量尠 (公斤)')' at line 1 這樣會死在第一行許功蓋的 "5C" \ 而第二行的 \xFB\xF3 又是我們資料輸入小組用excel 處理資料時會產生的 明明舊板 (3.23) 用的好好的, 我也無法為了新板 (5.1) 而要他們改作業模式 我們家的系統又有歷史包伏+公司政策, 在主機硬體報廢前不可能用 utf8 所以結論......... 無解........ 為什麼 Oracle/Sun 會把新板 MySQL 的 big5 搞成這樣呀...... -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 211.21.104.32 ※ 編輯: pingsky 來自: 211.21.104.32 (12/21 15:23)

12/25 01:05, , 1F
把.sql存成UTF-8 前面加set names "utf8" 然後倒回去?
12/25 01:05, 1F

12/26 00:25, , 2F
cp950這個編碼有試過嗎
12/26 00:25, 2F

12/26 01:01, , 3F
Navicat有試過嗎?可以互傳不同版本的MySQL...
12/26 01:01, 3F
文章代碼(AID): #1D45Lr5M (Database)
討論串 (同標題文章)
文章代碼(AID): #1D45Lr5M (Database)