代码之家  ›  专栏  ›  技术社区  ›  Ian

将mysqldump数据库备份中的单个表还原到同一数据库中的其他表?

  •  0
  • Ian  · 技术社区  · 16 年前

    2 回复  |  直到 16 年前
        1
  •  1
  •   Martin    16 年前

    您需要在restore db中创建表,并运行如下操作:

    grep "^INSERT INTO table" dump-file | mysql -u user -p restore-db
    

    首先确保您的模式匹配正确。

        2
  •  1
  •   Joe Goggins    15 年前
    cat THE_DUMP_FILE.SQL | sed -n "/^-- Table structure for table \`THE_TABLE_NAME\`/,/^-- Table structure for table/p" > THE_OUTPUT_SQL_FILE_NAME
    

    http://code.openark.org/blog/mysql/on-restoring-a-single-table-from-mysqldump

    推荐文章