나는 여기에 또 다른 대답을 얻지 못 했으므로 MySQL 덤프를 통하지 않고 PHP를 통해 수동으로 마이그레이션 프로세스를 수행하는 간단한 스크립트를 작성하는 것 외에는 선택의 여지가 없습니다.
다음은 스크립트입니다. 몇 가지 명백한 수정이 포함되어 있습니다. 스크립트는 "더티 코드"입니다. 보안되지 않을 수 있으며 가장 효율적이지는 않지만 내부적으로 사용하는 경우 작업을 완료해야합니다. 더 이상 수정하지 않고 스크립트가 일반인이 액세스 할 수있는 환경에서는 사용하지 마십시오.
<?php
$local = mysqli_connect([source server], [source username], [source password], [source DB name]) or die('No local connection');
mysqli_query($local, "SET NAMES 'hebrew'");
$remote = mysqli_connect([destination server], [destination username], [destination password], [destination DB name]) or die('No remote connection');
mysqli_query($remote, "SET NAMES 'utf8'");
$table_list = array('table1', 'table2', 'table3'); // you can get a list of tables automatically too if the list is very long
foreach ($table_list as $table)
{
$query_local = "SELECT * FROM `{$table}`";
$result_local = mysqli_query($local, $query_local) or die('Error in q1: '.mysqli_error($local));
$delete_remote = mysqli_query($remote, "DELETE FROM `{$table}` WHERE 1") or die('Error deleting table: '.$table); // necessary only if you plan to run it more than once
$i = 0;
while ($row_local = mysqli_fetch_assoc($result_local))
{
foreach ($row_local as $key => $value)
$row_local[$key] = mysqli_real_escape_string($remote, $value);
$query_remote = "INSERT INTO `{$table}` (`".implode('`, `', array_keys($row_local))."`) VALUES ('".implode("', '", $row_local)."')";
$result_remote = mysqli_query($remote, $query_remote)
or die('Error in remote q'.$i.' in table '.$table.':<br /> '.mysqli_error($remote).'<br /> Query: '.$query_remote);
echo 'Successfully transferred row '.$i.' in table '.$table;
echo '<br />'.PHP_EOL;
$i++;
}
}
?>