Blog
Browsing all articles tagged with How to import large mysql dump to database?
2

Faster Way To Import Mysql Dump

How to import large mysql dump to database? or Fastest mysql dump importer
Hey guys, it is difficult to import large mysql dump file to database. See below for how to import mysql dump using only one file.

Step 1: Download dump file. (e.g. demodb.sql).
Step 2: Change connection, username, password, database variable values.
Step 3: Change dump file name with proper path.
Step 4: Run this page.

Import mysql dump file code.

'; print mysql_error(); $temp = ''; $count = 0; while($line = fgets($file)) { if ((substr($line, 0, 2) != '−−') && (substr($line, 0, 2) != '/*') && strlen($line) > 1) { $last = trim(substr($line, −2, 1)); $temp .= trim(substr($line, 0, −1)); if ($last == ';') { mysql_query($temp); $count++; $temp = ''; } } } echo mysql_error(); echo "Total {$count} queries fire(s).\n"; echo "Enjoing this fastest mysql dump importer..\n"; echo '

';
?>

Enjoying this fastest mysql dump importer.