How to import database split in multiple part

Share on facebook
Share on twitter
Share on pinterest
Share on linkedin

During import and export operations, SQL databases allow uploading dump files with a maximum size. For small dimensions, is possible to fix this limitation (privileges required) changing a parameter in your php.ini in particular:


If your dump is more significant than 32 Megabytes, you could get some trouble during the import for a lot of reasons. Let’s go beyond this possible scenario, you can split your dump into multiple files with SQL Dump File Splitter and then import. Using the phpMyAdmin user interface or single line command of MySQL could be painful.

If you are a Windows user, I suggest saving this single line code into a .bat file format and use it to scan your folder and automatically import each dump in your database. !Reminder: MySQL command must be recognized by your prompt

    for /f %%f in ('dir *.sql /ODN /B {path}') mysql -u {username} --password={password} {database} < {path}\%%f

Let me explain how does it work.

{path} will be your path in which dumps are contained. The command:

    dir *.sql /ODN /B {path}

Will listed all the files contained in that path and made an alphabetic asc order (A-Z).

The following command:

    mysql -u {username} --password={password} {database} < {path}\%%f

Will interact with MySQL, in particular, will require the credential of the user allowed to work with your {database}. Use the {username}, {password} to access to the import function

Share on facebook
Share on twitter
Share on pinterest
Share on linkedin

Chi è Nils Lewin

Mi chiamo Nicola Bombaci alias Nils Lewin, sono un ingegnere informatico con la passione per la musica e l’audio. Durante la mia crescita professionale ho deciso di fondere questi due mondi apparentemente diversi tra loro.
Articoli Correlati

Lascia una risposta

Iscriviti alla newsletter

Resta sempre aggiornato sulle ultime novità