詳解MySQL導出指定表中的數據
要求:
1. 不導出創表的語句,因為表已經建好:默認會導出,先drop table然后create table;
2. 導出的insert語句加上ignore,允許重復執行:默認不會加上ignore;
3. insert語句中列出表中的字段,看得更清楚:默認不會;
4. 分記錄生成多條insert語句,修改起來比較容易:默認是一條;
最終結果如下:
mysqldump -pxxxxxx qzt qf1_mail_account --no-create-info --insert-ignore --complete-insert --skip-extended-insert >qf1_mail_account.sql
其中:
-pxxxxxx 指定密碼
qzt 數據庫名
qf1_mail_account 表名
>qf1_mail_account.sql 保存到文件
mysqldump --help 寫道
-t, --no-create-info Don't write table creation info. --insert-ignore Insert rows with INSERT IGNORE. -c, --complete-insert Use complete insert statements. -e, --extended-insert Use multiple-row INSERT syntax that include several VALUES lists. (Defaults to on; use --skip-extended-insert to disable.)
如有疑問請留言或者到本站社區交流討論,感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
新聞熱點
疑難解答