SMF Support > SMF 1.1.x Support

Restoring database (phpmyadmin being silly?)

<< < (2/3) > >>

Douglas:
php.ini

and it doesn't affect existing databases.

When I do a mass import, I import no more than 1000 lines at a time, sometimes it takes me an hour to implement a 15 meg database, but it's guaranteed to work better that way.

Spaceman-Spiff:
i used to save every 2500 lines for messages table
joined the other tables in 1 or 2 .sql files

another alternative is to break down the 3MB files to 3 @ 1MB files or something like that then upload one by one

Ben_S:
Which is fun, untill your db gets to 110 meg

Mecha Dude:
How do you split up the sql files?  Or should I search for a script that will parse the sql file by X number of tables into mysql at a time?

Mecha Dude:
Something like this to split it up?


--- Code: ---function splitfile( $infile, $outfile, $maxsize )
{
    // open input file
    $ifd = fopen( $infile, "r" );
    if( !$ifd )
    {
         // error opening input file
         return -1;
    }
    // first file number is 0
    $filenr = 0;
    // open first output file
    $ofd = fopen( $outfile . $filenr, "w" );
    if( !$ofd )
    {
         // error opening output file
         return -1;
    }
    // increase filenr
    $filenr++;
    // set size of output file to 0
    $size = 0;
    // while we can read a line from input file do ...
    while( $line = fgets( $ifd, 1000 ) )
    {
         // append the line to output file
         fputs( $ofd, $line );
         // add the size of the line
         $size = $size + strlen( $line );
         // if the size is > maxsize and this is the end of a statement
         if( $size > $maxsize && substr( chop($line), -1 ) == ";" )
         {
              // close output file
              fclose( $ofd );
              // open next output file
              $ofd = fopen( $outfile . $filenr, "w" );
              if( !$ofd )
              {
                   return -1;
              }
              $filenr++;
              // the output file has a size of 0 now
              $size = 0;
         }
    }
    // close the last output file
    fclose( $ofd );
    // return the number of output files generated
    return $filenr;}

--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version