MySQL之InnoDB引擎單表移植

來源:互聯網
上載者:User

標籤:innodb_file_per_table

MySQL5.6.6以後預設innodb_file_per_table=ON,開啟獨立資料表空間後每張表有二個檔案:

.frm file contains table structure/definition

.ibd file contains data of table as well as index


下面是InnoDB引擎獨立資料表空間單張表在不同Server之類的move:

一,在目的端建立和源表一樣的表結構(必須表結構一樣)

1,源端:show create table test.tb_name;

2,目的端:create database test;

create table tb_name;


二,丟棄資料表空間

ALTER TABLE dst_tb_name DISCARD TABLESPACE;


三,複製.frm和.ibd檔案到對應的資料庫目錄

cp tb_name.frm tb_name.ibd test/ -rf

chown mysql. test/ -R


四,匯入資料表空間

ALTER TABLE dst_tb_name IMPORT TABLESPACE;


五,根據具體需求重新命名表

rename table test.tb_name to test.tb_name_bak;

本文出自 “LinuxDream” 部落格,請務必保留此出處http://books.blog.51cto.com/2600359/1682736

MySQL之InnoDB引擎單表移植

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.