3 ways to import large SQL files into MySQL database
February 4, 2022 No Comments Tutorial rhalp10Importing large SQL files can be a challenge, especially if the server doesn't have enough resources to handle the import process.
Here are three potential ways to import large SQL files:
1. Using CMD (Command Prompt)
Using the command line interface (CMD or Terminal) to import large SQL files can be an effective solution, as it allows you to specify specific options and parameters for the import process. This can be done using the "mysql" or "mariadb" command, depending on the database management system you're using. For example:
mysql -u root -p databasename < "C:\downloads\sql\large_table.sql"
//use this instead if you have blob / json
mysqldump -u root -p databasename --hex-blob < "C:\downloads\sql\large_table.sql"
2. Configure WAMP / XAMP to increase upload and post limit.
Increasing the upload and post limits in your local development environment (e.g. WAMP or XAMPP) can also be a useful solution. This can allow you to upload and import larger SQL files without encountering errors or timeouts. To do this, you can edit the "php.ini" file in your WAMP or XAMPP installation and increase the "upload_max_filesize" and "post_max_size" values to a higher limit.

3. SQL dump splitter
Using a tool like SqlDump splitter can also be a good solution if the SQL file is too large to import all at once. SqlDump splitter is a tool that can split large SQL files into smaller chunks, and then import those chunks separately. This can help to avoid issues with PHP upload limits, and make it easier to import large SQL files in a more manageable way. To use SqlDump splitter, simply follow the step-by-step wizard to split your SQL file, and then import the resulting files using the mysql or mariadb command.
Download SQL dump splitter:
STEP 1:
Click the Right arrow, For the Next

STEP 2:
Click Browse > Select you SQL file
Select your Database engine
Click the Right arrow, For the Next

STEP 3:
Click Browse > Choose the location where you want the file saved
I recommend 5 MB for the maximum file size and mark check on ignore SQL comment lines
Click the Right arrow, For the Next

STEP 4:
On this panel, you will see the splitting process and have the option to cancel it by clicking Abort splitting
Click the Right arrow, For the Next

STEP 5:
This panel contains a summary of the process

Additionally, if you're having trouble importing large SQL files on a hosting site like GoDaddy or Hostinger, you may want to contact their customer support team to see if they can provide any assistance. They may be able to increase the resources available to your server, or provide other solutions to help you import the SQL file successfully.