Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysqldump limit records in between

mysqldump --opt --where="true LIMIT 100" dbname > dbname.sql

but what if I want records from row 2000 to 3000 ? like in general sql we can use LIMIT 2000, 3000; but is there any similar alterntative for mysqldump ?

like image 837
Chandan Gupta Avatar asked Aug 17 '11 12:08

Chandan Gupta


People also ask

What is the difference between Mysqldump and Mysqlpump?

mysqlpump is the 4th fastest followed closer by mydumper when using gzip. mysqldump is the classic old-school style to perform dumps and is the slowest of the four tools. In a server with more CPUs, the potential parallelism increases, giving even more advantage to the tools that can benefit from multiple threads.

Can Mysqldump lock tables?

By default, mysqldump locks all the tables it's about to dump. This ensure the data is in a consistent state during the dump.

Does Mysqldump lock DB?

By default, the mysqldump utility, which allows to back a MySQL database, will perform a lock on all tables until the backup is complete. In many cases, the amount of data in the database and the uptime requirements will not allow this lock in real life.

What is single transaction in Mysqldump?

The --single-transaction option of mysqldump does do a FLUSH TABLES WITH READ LOCK prior to starting the backup job but only under certain conditions. One of those conditions is when you also specify the --master-data option. In the source code, from mysql-5.6. 19/client/mysqldump.


1 Answers

there --where seems like sql injection prompt,
however is handy

mysqldump --opt --where="1 ORDER BY id LIMIT 2000, 1000" dbname > dbname.sql
like image 134
ajreal Avatar answered Sep 21 '22 02:09

ajreal