Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Simple use of MySQL Transport Table Space

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. The target creates the same table structure

CREATE TABLE `test` (

`id` int(11) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

2. The target keeps the.frm file and deletes the.ibd file

alter table test.test discard tablespace;

3. Add a read lock to the source-side table

flush table test.test for export;

4. Copy the.cfg and.ibd files to the destination data file location

scp test.ibd root@192.168.10.1:/usr/local/mysql/data/test

scp test.cfg root@192.168.10.1:/usr/local/mysql/data/test

5. source release lock

unlock tables;

6. Destination file grants permissions

chown -R mysql:mysql *

chmod -R 755 *

7. destination import table

alter table test.test import tablespace;

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report