Skip to content

Instantly share code, notes, and snippets.

@nhatnx
Created January 8, 2025 07:51
Show Gist options
  • Save nhatnx/eaa2cd7560b8839591cb85d56608ead7 to your computer and use it in GitHub Desktop.
Save nhatnx/eaa2cd7560b8839591cb85d56608ead7 to your computer and use it in GitHub Desktop.
[MySQL] Import a large (14 GB) MySQL dump file into a new MySQL database
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