Created
February 24, 2017 16:43
-
-
Save salaros/0bac4557b21f112aa8b63c999b110e39 to your computer and use it in GitHub Desktop.
Modifies a MySQL dump file (.sql) in order to improve its importing speed a little bit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sed -i '1s;^;\n;' $1 | |
sed -i '1s;^;\n;' $1 | |
sed -i '1s/^/SET autocommit=0;\n/' $1 | |
sed -i '1s/^/SET unique_checks=0;\n/' $1 | |
sed -i '1s/^/SET foreign_key_checks=0;\n/' $1 | |
echo '' >> $1 | |
echo '' >> $1 | |
echo '' >> $1 | |
echo 'COMMIT;' >> $1 | |
echo 'SET unique_checks=1;' >> $1 | |
echo 'SET foreign_key_checks=1;' >> $1 | |
echo 'SET autocommit=1;' >> $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment