Execute large MySQL scripts through phpMyAdmin

Execute large MySQL scripts through phpMyAdmin

Here’s a simple and convenient trick that I use quite often for doing repetitive MySQL script executes or to bypass file upload limits in phpMyAdmin/Apache. This example is based off my WAMP install but the procedure is the same for Linux too.

1. Browse to the directory where your phpMyAdmin is installed and create a folder called “upload”.  Paste any (as many) SQL scripts you would like to run in this folder.  Sorry, I blurred the name out on mine for security reasons.

screenshot_upload1

2.  Open your phpMyAdmin config file (config.inc.php).  You’ll find this in the root folder of your phpMyAdmin directory.

screenshot_config_location1

3.  In config.inc.php, edit the upload directory as shown circled below and save.

screenshot_edit

4. Now when you go into phpMyAdmin, you’ll see a new dropdown in the import tab that lists all the files you’ve inserted into the “upload” directory you created in step #1 above.

screensho_phpmyadmin1

So the next time you’re trying to upload a large SQL script to a remote server, try the above trick and then just FTP your files to the phpMyAdmin “upload” directory you created.  Select it from the dropdown in phpMyAdmin and run!

Note: You may have to increase max_execution_time & upload_max_filesize in php.ini and also the $cfg[‘ExecTimeLimit’] in the PhpMyAdmin config.default.php file (usually in the pma/libraries folder).  One other thing that may need to set is TimeOut in your apache config httpd.conf file.  If it’s not there, just add a line like; TimeOut 1500