Strip phpmyadmin export to databases 

Exporting all tables with phpMyAdmin is not a good idea since there are some system tables which cannot be written during the importing.
(information_schema, mysql, performance_schema, test). If you did it as I you can strip the dump to databases using it the following php script:


<?php

$databaseComment = "-- Adat";

$handle = @fopen("localhost.sql", "r";);
$outhandle = 0;
if ($handle) {
while (($buffer = fgets($handle)) !== false) {
if (substr($buffer, 0, 7) == $databaseComment) {
$first = strrpos($buffer, ':';) + 3;
$length = strlen($buffer) - 2 - $first;
$dbName = substr($buffer, $first, $length);
echo $dbName."<br>";
if ($outHandle !== 0) {
fclose($outHandle);
}
$outHandle = @fopen($dbName.".sql", "w";);
}
if ($outHandle !== 0) {
fputs($outHandle, $buffer);
}
}
if (!feof($handle)) {
echo "Error: unexpected fgets() fail\n";
}
fclose($handle);
}

?>


Modify the $databaseComment variable to your database separating comments of your language settings.
[ hozzászólás ] ( 4 megtekintés ) [ 0 trackbackek ] permalink ( 3.1 / 289 )

<< <Előző | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | Következő> >>

 
számláló