September 27, 2012

Import large sql files to phpmyadmin

have you ever encounter problem with importing large files like 300MB or more sql files into your phpmyadmin?
Here is the solution,

Open up your phpmyadmin config file, for me I am using MAMP on Mac,
opens up
[cc lang="php"]/applications/MAMP/bin/phpMyAdmin/

find $cfg['UploadDir' ] = 'upload' ; around line 530, change to
[cc lang="php"]$cfg['UploadDir'] = 'upload';

this script allow you to have an option to select the files to upload,
now go to line 143 change $cfg['ExecTimeLimit'] = 300; to
[cc lang="php"] $cfg['ExecTimeLimit'] = 0; // maximum execution time in seconds (0 for no limit)

as commented on the script, this prevent you from timeout when uploading a large file,
now go to same folder as create another folder call upload, put you large sql files inside and refresh your phpmyadmin again, go to import option, now you will see the option that allow you to select files that you just put in.