Limiting the number of records from mysqldump?

前端 未结 4 819
清酒与你
清酒与你 2020-12-12 09:51

I am trying to load a small sample of records from a large database into a test database.

How do you tell mysqldump to only give you n records out of 8 million?

4条回答
  •  余生分开走
    2020-12-12 10:44

    If you want to get n records from a specific table you can do something like this:

    mysqldump --opt --where="1 limit 1000000" database table > dump.sql
    

    This will dump the first 1000000 rows from the table named table into the file dump.sql.

提交回复
热议问题