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.

Categories
Coding and Logic

Dump MySQL Database to a file on Windows

Most of the people out there are talking about dumping MySQL Database to a file on Linux servers. Many of you must be using MySQL on Windows, with WAMP. However, most of the PHP and MySQL powered websites and applications are hosted on a Linux server, most of the developers must be using WAMP on Windows, as their local development platform. What if you added a new developer to the development team and you all are using your own computer as your local development environment, how will you provide the current MySQL database to the new developer. There is a great chance that you must be using phpMyAdmin. Using phpMyAdmin, you can export your database and save (download) it as a SQL file with zero compression or compressing as zipped or gzipped. But what if you have a large database (in my case, it’s around 100 MB, that means, lots of data)?