0

I import a db from a large mysqldump file, the file is about 200GB, after import, the db shows only partial tables, some tables were not imported. The process produced no error. here are the commands:

nohup mysql -uroot -ppass db_name <dumpfile.sql &
4
  • if you backgrounded it without directing stdout/stderr to a file, how do you know that no errors or warnings were actually produced?
    – imm
    Oct 10, 2011 at 0:37
  • it redirected output to nohup.out by default
    – user881480
    Oct 10, 2011 at 0:39
  • Any reason you did that with nohup and &? Can you retry that in screen? Can you check that the partial tables are complete in that dumpfile.sql?
    – ott--
    Oct 10, 2011 at 1:01
  • because it's a remote server and I use ssh terminal to do it, there are tables in that dumpfile that doesn't exist in the final db.
    – user881480
    Oct 10, 2011 at 11:31

1 Answer 1

0

Better to create a single dump for each table then no need to do the whole import on failure.

Suppose your db is named MyTestDB

$ mysql -u<dbuser> -p<dbpass> -h<dbhost> MyTestDB -e "SHOW TABLES" > ./tablelist.txt

That creates a table list file in the current directory Now dump the tables to a folder called dbdump

$ for table in `cat ./tablelist.txt`; do echo $table; mysqldump -u<dbuser> -p<dbpass> -h<dbhost> MyTestDB $table > ./dbdump/$table.sql

Similarly to import it into the db

$ for table in `cat ./tablelist.txt`; do echo $table; mysql -u<dbuser> -p<dbpass> -h<dbhost> MyTestDB  < ./dbdump/$table.sql

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.