關於 PHP, Linux, Open Source 及個人生活記載的網誌。
RSS icon
  • 用 mysqldump 擷取部份樣本資料

    Posted on September 9th, 2009 Sam Tang No comments

    如果需要將 mysql server 的小部份資料匯入到測試主機上測試,可以配合 mysqldmp 的 -where="true LIMIT X" 選項,上的的 X 是想擷取的資料數量,例如:

    # mysqldump –opt –where="true LIMIT 10000" mydb > mydb.sql

    以上的指令會將 mydb 內所有資料表各自匯出 10000 筆資料

    這個方法可以很容易匯出較小的資料樣本件測試用途。


    Leave a reply

    *
    To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
    Click to hear an audio file of the anti-spam word