将MySQL表分解成块

时间:2023-02-08 23:47:19

I would like to backup one big innodb MySQL table, but unfortunately don't have enough free space to create a full dump of it. So I thought about dividing the backup to two parts. Meaning I will dump half of the table, move that file to an external backup location, and than backup the second half and move it also.

我想备份一个大型的innodb MySQL表,但不幸的是没有足够的空闲空间来创建它的完整转储。所以我想把备份分成两部分。这意味着我将转储表的一半,将该文件移动到外部备份位置,而不是备份后半部分,并将它也移动。

I'm used to doing: mysqldump --user=$user --password=$pass --single-transaction --quick

我习惯了这样做:mysqldump——user=$user——password=$pass——单事务——quick

How can I perform such an operation one half at a time?

我怎么能一次只做一半呢?

1 个解决方案

#1


3  

You can backup specifics tables like this

您可以备份这样的特定表

Tables t1, t2, and t3 from your DB.

表t1, t2,和t3从你的DB。

mysqldump -u... -p... mydb t1 t2 t3 > mydb_tables.sql

Or you can create a mouting point (unix) or network drive (windows) and make your backup directly on it.

或者您可以创建一个鼠标点(unix)或网络驱动器(windows),并在其上直接进行备份。

If you want to backup just a table in multiple part

如果您只想备份多个部分中的一个表

mysqldump --databases X --tables Y --where="1 limit 1000000"
mysqldump --databases X --tables Y --where="myColumn < 1000"

#1


3  

You can backup specifics tables like this

您可以备份这样的特定表

Tables t1, t2, and t3 from your DB.

表t1, t2,和t3从你的DB。

mysqldump -u... -p... mydb t1 t2 t3 > mydb_tables.sql

Or you can create a mouting point (unix) or network drive (windows) and make your backup directly on it.

或者您可以创建一个鼠标点(unix)或网络驱动器(windows),并在其上直接进行备份。

If you want to backup just a table in multiple part

如果您只想备份多个部分中的一个表

mysqldump --databases X --tables Y --where="1 limit 1000000"
mysqldump --databases X --tables Y --where="myColumn < 1000"