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
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1c2830e-338d1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1c2830e-338d1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?