How To Import Large SQL Database Files Into MySQL Using Command Line

When you have large SQL file and you want to import it into your database using phpMyAdmin, while uploading, an error is shown in phpMyAdmin. The error that appears is displayed below.

Error:

You probably tried to upload too large file. Please refer to documentation for ways to workaround this limit.

In such case, follow the below given steps:

  1. Open php.ini file from C:\xampp\php and update the following lines.

    max_execution_time = 259200

    max_input_time = 259200

    memory_limit = 1000M

    upload_max_filesize = 750M

    post_max_size = 750M

    You can change the respective data sizes according to your convenience.You can change the data sizes according to your SQL File.


    Open php.ini file and find the changed variable values. After confirming the checked data,start XAMPP Server and Upload the data using Import Function in phpMyAdmin. If data will not uploaded successfully then go to second step . I am sure second step definitely large data upload into your data server .

  2. I have given this example by keeping localhost in mind,i.e, here these steps will work only with the LocalServer. If you want to try this on the main server then you have to use PUTTY Software for that.

    Introduction To PUTTY
    is been explained in the below link,

    Reference link: 
    https://support.rackspace.com/how-to/connecting-to-linux-from-windows-by-using-putty/

    Now we will learn to upload data in Xampp using CMD.

     
                                  Fig: Open CMD Prompt 
                                                                      Fig: CMD Open
     
    First step is to create
    a database,
     
    Now type a command in cmd to show all the files included in the database by typing show database.
      
    After creating and selecting the database, Import the sql file using this command.
     
    Press Enter,

     
    Now create a table and insert rows in the database

    You have successfully completed the process to upload a large database in MySQL.
Read more articles on Databases:

Up Next
    Ebook Download
    View all
    Learn
    View all