Heim  >  Artikel  >  Datenbank  >  MySQL导出指定表中的数据

MySQL导出指定表中的数据

WBOY
WBOYOriginal
2016-06-07 17:13:321017Durchsuche

MySQL导出指定表中的数据 要求: 1. 不导出创表的语句,因为表已经建好:默认会导出,先drop table然后create table;2. 导出的i

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.)

linux

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn