Those fun moments when you have to import SQL that are 100s of MB large to accommodate development of existing projects. Getting your local setup completed can be a hassle if you try to go the UI route of using phpmyadmin or similar to handle the import. Save yourself the time go straight to the command line and do the import. It’s faster.
If you use Mamp, Wamp, Lamp or any similar stack they install the mysql client on your machine so you can simply dial-up your command window and login
mysql -u username -p
When prompted enter your password. Followed by stating which database you want to import into.
use DB ;
Then simply import your desired file.
SET autocommit=0 ; source file.sql ; COMMIT ;
By turning off autocommit first we speed up the import that occurs by the source command (executes the sql statements in the file) then we finish off with a commit. Simple and saves yourself the hassle of having to increase file limit sizes in php and etc.
Comments & Questions
Add Your Comment