您的当前位置:首页正文

MYSQL表空间迁移

2020-11-09 来源:个人技术集锦

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入 32.ERROR 1031 (HY000): Table storage engine for 'city' doesn't havethis option 33.mysql alter table cityengine=innodb; 34.mysql flush table cityfor export; --对表加锁。 35.Query OK, 0 r

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入

  32.ERROR 1031 (HY000): Table storage engine for 'city' doesn't havethis option

  33.mysql> alter table cityengine=innodb;

  34.mysql> flush table cityfor export; --对表加锁。

  35.Query OK, 0 rows affected (0.18 sec)

  36.

  复制表文件到目标位置

  C:\ProgramData\MySQL\MySQL Server 5.6\data\world>mkdir city

  C:\ProgramData\MySQL\MySQL Server 5.6\data\world>copy city.* city

  city.cfg

  city.frm

  city.ibd

  3 file(s) copied.

  C:\ProgramData\MySQL\MySQL Server 5.6\data\world>cd city

  C:\ProgramData\MySQL\MySQL Server 5.6\data\world\city>dir

  Volume in drive C has no label.

  Volume Serial Number is D0FA-F7A0

  Directory of C:\ProgramData\MySQL\MySQL Server 5.6\data\world\city

  10/10/2013 10:58 AM

.

  10/10/2013 10:58 AM

..

  10/10/2013 10:53 AM 582 city.cfg

  10/10/2013 10:53 AM 8,710 city.frm

  10/10/2013 10:53 AM 475,136 city.ibd

  3 File(s) 484,428 bytes

  2 Dir(s) 224,676,024,320 bytes free

  在目标库上删除可能存在的同名表空间。

  mysql> unlock tables;--释放锁。

  2. Query OK, 0 rowsaffected (0.07 sec)

  3. mysql> alter table city discard tablespace;删除可能存在的同名表空间

  4. Query OK, 0 rowsaffected (0.23 sec)

  5. mysql> selectcount(*) from city;

  6. ERROR 1814 (HY000):Tablespace has been discarded for table 'city'

  7. mysql> alter tablecity import tablespace;

  8. ERROR 1146 (42S02):Table 'world.city' doesn't exist

  9. C:\ProgramData\MySQL\MySQLServer 5.6\data\world\city>copy city.* ..

  10.city.cfg

  11.city.frm

  12.Overwrite ..\city.frm? (Yes/No/All): yes

  13.Access is denied.

  14.city.ibd

  15. 2 file(s) copied.

  16.C:\ProgramData\MySQL\MySQL Server 5.6\data\world\city>

  17.mysql> alter table city import tablespace;

  18.Query OK, 0 rows affected (0.94 sec)

  19.mysql> select count(*) from city;

  20.+----------+

  21.| count(*) |

  22.+----------+

  23.| 4079 |

  24.+----------+

  25.1 row in set (0.08 sec)

  表空间被成功。

[1] [2]

显示全文