In this tutorial we will find out how to import a large sql file into MySQL database.
Steps:
- Split database dump into individual tables
- Import these individual tables to database
Splitting database dump into individual tables
Download script which will be used to split database into individual tables
1
2
3
4
5
|
wget -O mysqldumpsplitter.sh https://raw.githubusercontent.com/vinodpandey/mysqldumpsplitter/master/mysqldumpsplitter.sh
chmod +x mysqldumpsplitter.sh
|
Run script to split database dump into tables
1
2
|
sh mysqldumpsplitter.sh --source database-dump.sql --extract ALLTABLES --decompression none
|
Extracting single table
1
2
3
|
sh mysqldumpsplitter.sh --source database-dump.sql --extract TABLE --match_str table_name --decompression none
|
Importing table into database
1
2
3
|
pv table-name.tar.gz | mysql -uroot -p db_name
|