Import mysql dump using php

后端 未结 4 951
北荒
北荒 2021-02-10 14:06

I have mysql dump file. How I can import this file into mysql using php?

4条回答
  •  走了就别回头了
    2021-02-10 14:26

    U can use multi_query, to import database dump files of medium file-size.

    $command = file_get_contents($dumpfile);
    $conn->multi_query($command);
    while (mysqli_next_result($conn)); // Flush out the results.
    

    Note: The exact file-size limit would be dependent on your server configuration eg. max_allowed_packet etc.

提交回复
热议问题