Tags
MySQL
Asked 6 years ago
5 Oct 2018
Views 1103
debugger

debugger posted

how to large split sql file to smaller multi files ?

i downloaded mysql based file dump.sql file and its large upto 400 mb and i want to upload it server but its saying timeout so i can do split it and upload one by one

joomler

joomler
answered Apr 25 '23 00:00

If you have a large SQL file that you want to split into smaller files, there are several ways to accomplish this task. Here are some methods that you can use:

1.Use a text editor: You can open the large SQL file in a text editor such as Notepad++ or Sublime Text, and manually copy and paste sections of the SQL code into new files.

2.Use a command-line tool: If you're comfortable with the command line, you can use tools like split or csplit on Linux or macOS to split the SQL file into smaller pieces. For example, to split a file called large.sql into 10 smaller files with 1000 lines each, you can use the following command:


split -l 1000 large.sql smallfile

This will create 10 files named smallfileaa, smallfileab, smallfileac, etc., each containing 1000 lines of SQL code.

3.Use a third-party tool: There are many third-party tools available that can split large SQL files into smaller files automatically. One such tool is BigDump, which is a PHP script that can split a large SQL file into multiple smaller files and import them into a database.

To use BigDump, you need to upload the script and the large SQL file to your server, and then run the script in your web browser. The script will prompt you to enter the database details and the path to the SQL file, and it will automatically split the file into smaller pieces and import them into the database.

Note that when using third-party tools, it's important to ensure that they are secure and trustworthy, and to always back up your data before running any scripts or tools.
Post Answer