Skip to content

Instantly share code, notes, and snippets.

@BorysVrublevskyi
Last active November 17, 2022 09:05
Show Gist options
  • Save BorysVrublevskyi/0703d7d3f79a5aa649fd72875bdc14b1 to your computer and use it in GitHub Desktop.
Save BorysVrublevskyi/0703d7d3f79a5aa649fd72875bdc14b1 to your computer and use it in GitHub Desktop.
MySQL backup and restore
mysqldump --routines --single-transaction EventLogging | gzip -c > eventlogging.sql.gz
gunzip < /tmp/eventlogging.sql.gz | mysql -u root -p EventLogging

For big backup file

mysql -u root -p
set global net_buffer_length=1000000; --Set network buffer length to a large byte number
set global max_allowed_packet=1000000000; --Set maximum allowed packet size to a large byte number
SET foreign_key_checks = 0; --Disable foreign key checking to avoid delays,errors and unwanted behaviour
source file.sql --Import your sql dump file
SET foreign_key_checks = 1; --Remember to enable foreign key checks when procedure is complete!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment