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

前端 未结 18 1959
你的背包
你的背包 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:48

    Command Line

    Import / Export for single table:

    Exporting table schema

     -> mysqldump -u your_user_name -p your_database_name table_name > test.sql
    

    This will create a file named test.sql and creates table sql command to create table table_name.

    Importing data into table

     -> mysql -u your_user_name -p database_name table_name < test.sql
    

    Make sure your test.sql file is in the same directory, if not navigate through the path and then run the command.

提交回复
热议问题