为了更快地迁移我的数据库,我尝试将数据库的原始文件(MYD和MYI)文件复制到另一台机器中。除了两个已分区的表之外,所有表都正常工作。我的目录结构如下所示:
table1.frm
table1.MYI
table1.MYD
table2.frm
table2.par
table2#P#p0.MYD
table2#P#p0.MYI
table2#P#p1.MYD
table2#P#p1.MYI
table3.frm
table3.par
table3#P#p0.MYD
table3#P#p0.MYI
table3#P#p1.MYD
table3#P#p1.MYI
以下是产生错误:
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.06 sec)
mysql> use test;
Database changed
mysql> show tables;
+---------------------------+
| Tables_in_test |
+---------------------------+
| table1 |
| table2 |
| table3 |
+---------------------------+
3 rows in set (0.00 sec)
mysql> explain table1;
+-------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| a | int(11) | YES | | NULL | |
+-------+---------+------+-----+---------+----------------+
2 rows in set (0.01 sec)
mysql> explain table2;
ERROR 1017 (HY000): Can't find file: 'table2' (errno: 2)
mysql> explain table3;
ERROR 1017 (HY000): Can't find file: 'table3' (errno: 2)
mysql> check TABLE table2;
+--------------------------+-------+----------+--------------------------------------------------+
| Table | Op | Msg_type | Msg_text |
+--------------------------+-------+----------+--------------------------------------------------+
| test.table2 | check | Error | Can't find file: 'table2' (errno: 2) |
| test.table2 | check | error | Corrupt |
+--------------------------+-------+----------+--------------------------------------------------+
2 rows in set (0.00 sec)
我检查了权限,一切看起来都很好。我试过修理,但似乎也没有用。有什么可以做的吗?
答案 0 :(得分:1)
您移植到的服务器可能没有启用分区。
尝试SHOW VARIABLES LIKE '%partition%';
并检查变量have_partioning
或have_partition_engine
的值(取决于您的mysql版本)。
更多信息可在documentation。
中找到