Fastest way to copy table between databases
Posted by:
Wim Roffel
Date: September 17, 2024 11:31PM
I have two databases and I want to copy a table from one to the other. My ideal code would look something like:
$oldconn = mysqli_connect(OLD_SERVER, OLD_USER, OLD_PASSWORD);
$newconn = mysqli_connect(NEW_SERVER, NEW_USER, NEW_PASSWORD);
$query = "INSERT INTO `newserver.`newdb`.`newtable` SELECT * FROM `oldserver.`olddb`.`oldtable`";
mysqli_query($newconn, $query);
But that doesn't even work when the servers are the same and only the database accounts differ.
So what is the fastest alternative? Export to file? Select/insert row by row?
Subject
Written By
Posted
Fastest way to copy table between databases
September 17, 2024 11:31PM
September 18, 2024 04:59AM
Sorry, only registered users may post in this forum.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.