Importing large databases sucks. It can take anywhere from as short as 10 min to a few hours. Worse is when it fails mid-import. So here is a faster way to import. This script can import a 30gb database in under 40min reliably.
Disclaimer:
This tutorial is only for macOS users. If you’re on windows, good luck.
Prerequisites:
Must use MAMP
Must have Homebrew installed
Install these using Brew
brew install pv
brew install pigz
Placing the fast import script
Download the file from my GitLab
Make sure its placed inside this folder
/users/<your_username_here>
Update the permission of the file
~/ chmod +x ~/fast_mysql_import.sh
Update zshrc, include MAMP path
echo 'export PATH="/Applications/MAMP/Library/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
Run the script
./fast_mysql_import.sh ~/Desktop/smaplivedb-20260303-0630.sql.gz smap030326 root
Credits to Danish for creating the script.
Comments
Post a Comment