How to import a single table in to mysql database using command line

前端 未结 18 1938
你的背包
你的背包 2020-12-22 15:25

I had successfully imported a database using command line, but now my pain area is how to import a single table with its data to the existing database using command line.

18条回答
  •  不思量自难忘°
    2020-12-22 15:42

    If you're in the pwd of an SQL dump and you need a table from that, do this:

    sed -n '/-- Table structure for table `'TableNameTo_GrabHere'`/,/-- Table/{ /^--.*$/d;p }' dump_file_to_extract_from.sql > table_name_here.sql
    

    Then just import the table you extracted from the above into the needed database

提交回复
热议问题