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

MySQL data migration using the MySQLdump command

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

The advantage of this scheme is that it is simple and easy to handle, and the disadvantage is that the downtime is long. Therefore, it is suitable for a small amount of data, or allow a long downtime, and can be completed within this time range.

Here are some uses of the MySQLdump command:

1. Export the data and table-building files of the entire database to a sql file

Mysqldump-uroot-proot database1 > database1.sql

two。 Import the data from the sql file, no longer mysqldump, but mysql

Mysql-uroot-proot database2

< database1.sql 3.将数据库中的某个表的数据及结构导出到sql文件中 mysqldump -uroot -proot database1 tablename >

Table1.sql

4.。 Import the data from the sql file, no longer mysqldump, but mysql

Mysql-uroot-proot database1

< database1.sql 5.mysql 数据迁移命令 备份database库table表中id大于22的数据,SQL如下 mysqldump -u test -ptest database table --default-character-set=gbk -t --where="id>

22 "> c:\ test.sql

6. Backup the information of the students over the age of 30.

Mysql > select * from students where Age > 30 into outfile'/ tmp/stud.txt'; mysql > load data infile'/ tmp/stud.txt' into table students

Summary

The above is the whole content of this article. I hope the content of this article has a certain reference and learning value for everyone's study or work. Thank you for your support. If you want to know more about it, please see the relevant links below.

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