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

How to import large SQL files into a Database?

When you have a 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 a file. Please refer to the documentation for ways to work around this limit.

In such case, follow the below-given steps:

Open the 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.

phpFile

Open the 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 be uploaded successfully, then go to the second step. I am sure the second step definitely large data upload into your data server.

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. The 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.

Step 1. Open CMD Prompt

cmd

Step 2. 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.

usingDB

Step 3. Press Enter

success

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:


Similar Articles