How does mysql export the first N records of each table in a library?

it is OK to import the first N records of a single table, but now there are almost 40 or 50 tables in the whole library, which is too time-consuming and stupid. Want to export the first 1000 records of each table in a database at once. Many online searches can not find a good answer. Also ask all the great gods to give us some advice

Nov.01,2021

mysqldump-uroot-pxxx-- where= "1 limit 100"-A > / tmp/dump.sql


  • if you just want data from a specified library, you can copy down the table name and put it in an array, and then traverse to run sql. It's easy for python, php to do such a thing.
  • if you want to implement this function in a program, you can first look up all the tables in the database (select table_name from
    information_schema.tables where table_schema=' database name'), and then traverse
Menu