I have found myself several times trying to import a very large SQL file (5GB) into phpMyAdmin, which cannot upload such a large file.
So, I tried to open it with Notepad or even in a web editor, but again, the file was rejected because it was too large!

Here are some solutions to handle these large files, which have helped me and will help me again.

Our main tool will be the DOS console (Command Prompt).

Read the file gradually

Ideal for searching for information in the database without having to import everything (but it may take a while…)

Open a DOS window (Start > All Programs > Accessories > Command Prompt).

Type the following command:

MORE chemin_de_votre_fichier

Example:

MORE C:\import\dumpDB.sql

Press the « Enter » key to display a new line and check the data gradually.

Import the entire database

To import the entire database (long, but effective), here’s how to do it.

In your phpMyAdmin, create a new empty database that will host the content of the database to import.

Then, open a DOS window (Start > All Programs > Accessories > Command Prompt) and type the following command:

C\:wamp\bin\mysql\mysql5.6.17\bin\mysql.exe -u root -p

Or go to the WAMP icon at the bottom right (next to the clock), then in MySQL > MySQL Console.

On Mac, you need to open the Terminal and type the command:

/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot

You will be prompted for your password; if there isn’t one, just press « Enter ».

Select the empty database you created:

mysql> use nom_de_la_base

Finally, execute the commands from your file to import:

mysql> source chemin_de_votre_fichier

Example:

mysql> use test_base
mysql> source C:\import\dumpDB.sql

You will get results like this:

Query OK, 0 rows affected (0.00 sec)
 
Query OK, 0 rows affected (0.01 sec)
 
Query OK, 2 rows affected (0.03 sec)
Enregistrements: 2  Doublons: 0  Avertissements : 0
 
Query OK, 0 rows affected (0.00 sec)
 
Query OK, 0 rows affected (0.23 sec)

This will last throughout the import, you need to be patient… Then finally you will see again:

mysql>

Which will indicate that the import is complete.

Good luck!