Copying data

If you want to copy data from one table to another, you can either use mysqldump or mysqlpump to back up certain rows and then load them into the destination table. As an alternative, you can also use pt-archive. If you specify the --no-delete option, pt-archiver will not delete the rows from the source:

shell> pt-archiver --source h=localhost,D=employees,t=employees --dest h=localhost,D=employees_archive -u <user> -p<pass> --where="1=1" --no-check-charset --limit 10000 --commit-each --no-delete

Get MySQL 8 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.