Categories
Coding and Logic

Importing MySQL Database in Mac Terminal

Few days back I have posted “How to Dump MySQL Database to a file on Windows”. Exporting large database in phpMyAdmin is not much difficult (however the “command line” method is better), but importing large database in phpMyAdmin is a real headache. First you need to allow to upload a large file. For this you need to change your php settings (you need to modify php.ini file). Your application may not need to upload such large files, but you need to modify this for uploading large database dump file. Then it’ll take a bit long time to upload the huge database file. Then when phpMyAdmin will execute huge number of lines SQL, crossing the maximum execution time and again starting from the point, whether it just crossed maximum execution time. During this process, if you encounter any other problem, then you will have a bigger headache. So you should always prefer importing large MySQL database using command line, i.e. Terminal in Mac. You will find many resources on web discussing about how to Import MySQL Database in linux. But you will find very less resource on Importing MySQL Database in Mac Terminal. So, I decided to write about this here.