Instagram

Wiki It

Search results

Saturday, 8 June 2013

Importing large files into mysql using phpmyadmin and command line



Before I forget to save this information somewhere I thought I would write this blog. I have had enough trouble just because of this error that I used to get when ever I tried importing large SQL files into MySQL.

If you had ever got this error message below then you must thank me for this tutorial for solving your problem :P


PHPMyAdmin already has an inbuilt import functionality but I have had problems importing large database files.

Firstly search for the config.inc.php file which in my case was in the following path

C:\Program Files (x86)\EasyPHP-DevServer-13.1VC9\modules\phpmyadmin3581x130608223830\

Find the line with:
$cfg['UploadDir'] = 'some path'; and update it to $cfg['UploadDir'] = 'upload';

Save and exit the file. After doing this, create a folder by name 'upload' inside 

C:\Program Files (x86)\EasyPHP-DevServer-13.1VC9\modules\phpmyadmin3581x130608223830\

and paste your large SQL file inside this directory. After doing so you will see a dropdown inside the Import section of your PHPMyAdmin and your file listed in the dropdown. Select it and click GO to import it. 

If at all if you like to do it via command line then,

C:/path_to_your_upload_dir> mysql -h hostname -u username -p databasename > filename.sql

Replace the host, username and database with the one you want to import. Before trying this you need to make sure that you have a username, database created for the file you are going to import into the database. This will ask for the password as well for which you should give the one you created while creating the user. 

This would take a few minutes depending upon your file size. Thanks once again, hope this helps someone. Thank you!
















No comments:

Post a Comment