2010年6月30日

MySQL 4.0.23 のデータを MySQL 5.1.47に移動させると、

女性像。六甲アイランドにある好きな像なのだが、痛みが激しく、悲しい。

 Windows2000 server上の MySQL 4.0.23 のデータをディレクトリごと、Windows2003 server上の MySQL 5.1.47 に移動させると、あら不思議、文字列の長さの指定が半分に減ってしまいます。でもデータはそのまま詰め込まれた状態。

 予め分かっていれば何のことはないんだけど、気が付かなかったら結構厄介なことになってそう。まぁ、気が付いて良かった。

Welcome to the MySQL monitor.  Commands end with ; or ¥g.
Your MySQL connection id is 14810
Server version: 4.0.23-nt

Type 'help;' or '¥h' for help. Type '¥c' to clear the current input statement.

mysql> explain  Class;
+------------+---------------+------+-----+---------+-------+
| Field      | Type          | Null | Key | Default | Extra |
+------------+---------------+------+-----+---------+-------+
| Class      | varchar(20)   |      | PRI |         |       |
| Class_j    | varchar(40)   | YES  |     | NULL    |       |
| p          | varchar(20)   | YES  |     | NULL    |       |
| ts         | timestamp(14) | YES  |     | NULL    |       |
| Class_auth | varchar(40)   | YES  |     | NULL    |       |
| Class_e    | varchar(40)   | YES  |     | NULL    |       |
+------------+---------------+------+-----+---------+-------+
6 rows in set (0.01 sec)


Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.47-community MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> explain  Class;
+------------+-------------+------+-----+-------------------+-----------------------------+
| Field      | Type        | Null | Key | Default           | Extra                       |
+------------+-------------+------+-----+-------------------+-----------------------------+
| Class      | varchar(10) | NO   | PRI |                   |                             |
| Class_j    | varchar(20) | YES  |     | NULL              |                             |
| p          | varchar(10) | YES  |     | NULL              |                             |
| ts         | timestamp   | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| Class_auth | varchar(20) | YES  |     | NULL              |                             |
| Class_e    | varchar(20) | YES  |     | NULL              |                             |
+------------+-------------+------+-----+-------------------+-----------------------------+
6 rows in set (0.06 sec)
mysql> select length(class) as l, class from class;
+----+--------------------+
| l  | class              |
+----+--------------------+
| 14 | Actinopterygii     |
| 14 | Agaricomycetes     |
|  8 | Amphibia           |
|  8 | Anthozoa           |
|  9 | Arachnida          |
| 10 | Asteroidea         |
|  4 | Aves               |
|  8 | Bivalvia           |
| 11 | Cephalopoda        |
|  9 | Chilopoda          |
| 14 | Chondrichthyes     |
| 13 | Coniferopsida      |
|  9 | Crustacea          |
|  7 | Cubozoa            |
| 11 | Cycadopsida        |
|  9 | Diplopoda          |
| 10 | Echinoidea         |
| 13 | Equisetopsida      |
| 10 | Gastropoda         |
| 12 | Ginkgoopsida       |
| 14 | Hexactenellida     |
| 13 | Holothuroidea      |
| 18 | Homobasidiomycetes |
|  8 | Hydrozoa           |
| 13 | Hymenomycetes      |
|  7 | Insecta            |
| 11 | Leptocardia        |
| 10 | Liliopsida         |
|  9 | Lingulata          |
| 13 | Magnoliopsida      |
| 12 | Malacostraca       |
|  8 | Mammalia           |
|  4 | Nuda               |
| 11 | Ophiuroidea        |
| 12 | Osteichthyes       |
|  9 | Pinopsida          |
| 10 | Polychaeta         |
| 12 | Pteridopsida       |
| 11 | Pycnogonida        |
|  8 | Reptilia           |
| 13 | Sarcopterygii      |
|  9 | Scyphozoa          |
| 11 | Tentaculata        |
| 11 | Turbellaria        |
| 11 | Ulvophyceae        |
| 14 | Vestimentifera     |
|  9 | Xephosura          |
+----+--------------------+
47 rows in set (0.00 sec)

0 件のコメント: