Running a Really Big MySql File Without SSH
I ran into a situation today that left me no sysadmin way to restore a database on a remote host. No SSH with tech support looking into it. The file was huge compressed and did not play nice with phpmyadmin. Impatient, I thought why not a programmer solution, so 8 minutes later the restore was done. In case this helps here is all there is to it. The execution of the 200MB file took 15 seconds on a plain jane VPS.
Do NOT leave this file on the server after you are done!
ini_set('max_execution_time', 600); ini_set('display_errors', 'On'); error_reporting(E_ALL); $sql_file = '/path/to/bigfile.sql'; $db = 'db_name'; $user = 'db_user'; $pw = 'db_pw'; echo $sql_file.'Results (if any):'; if(file_exists($sql_file)){ system('mysql -u '.$user.' -p'.$pw.' '.$db.' < '.$sql_file); echo 'Done'; } else{ echo 'fail'; }