Created
January 20, 2017 11:44
-
-
Save shoaibi/e9ece345667f3d39b797f585dfb66618 to your computer and use it in GitHub Desktop.
Restore large databases
This file contains 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
echo "Restoring $1" | |
queries=" | |
-- Set network buffer length to a large byte number\n | |
set global net_buffer_length=1000000;\n | |
-- Set maximum allowed packet size to a large byte number\n | |
set global max_allowed_packet=1000000000;\n | |
-- Disable foreign key cheking to avoid delays,errors and unwanted behaviour\n | |
SET foreign_key_checks = 0;\n | |
source $2;\n | |
SET foreign_key_checks = 1;\n | |
" | |
mysql $1 -e "$queries" > /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment