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

How to migrate mysql database

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to migrate mysql database". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to migrate mysql database.

The above are the requirements of the tester, and 2 pieces of useful information can be extracted.

1. The four tables marked below only need to migrate the table structure.

2. Tables other than these four tables need to be migrated.

First of all, query the amount of data in this library and select the migration method.

The database is only about 100G, and the four tables marked with only the migrated table structure occupy more than 90 gigabytes. Therefore, mysqldump is chosen to migrate.

The following are the results of the test:

Test environment: migrate the table structure a under database yz on the 192.168.56.21 server to the 192.168.56.22 server

First, test the structure of the migration table

The data of a under the original 192.168.56.21 server yz:

1) Migration table structure statement: where-- opt is the option to migrate only the table structure

[root@mysql2 bak] # / data/mysql/bin/mysqldump-h292.168.56.21-uroot-proot-- opt-d yz a > a.sql

The details of the file a.sql are as follows:

2) restore

Restore statement: [root@mysql2 bak] # mysql-uroot-proot yz c.sql

The details of the file c.sql are as follows:

You can see that only the data and structure of tables an and b have been migrated

2) restore

Restore statement: [root@mysql2 bak] # mysql-uroot-proot yz

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