How to copy a database with mysqldump and mysql in Python?

后端 未结 3 596
名媛妹妹
名媛妹妹 2021-01-03 05:07

I am writing a simple Python script to copy a MySQL database. I am attempting to copy the database based on the following SO questions and their answers: \"Copy/duplicate da

3条回答
  •  梦毁少年i
    2021-01-03 05:46

    One problem that I saw is on this line:

    p2 = Popen(args1, stdin=p1.stdout, stdout=PIPE, stderr=STDOUT)
    

    It should read:

    p2 = Popen(args2, stdin=p1.stdout, stdout=PIPE, stderr=STDOUT)
    

    (args1 were being passed to the second proc, so that the program did two dumps and zero restores)

提交回复
热议问题