• Call us: +977-980 116102
How can I import a large MySQL dump file into a new MySQL database?
Mysql large database import?
How to import a large sql file to MySql via command line?

Stumbled Across these Questions?

Well, Here’s a FIX:

Steps 1: Go to CMD
Step 2: Enter Command: mysql -u “username” -p
Enter Password: “Your Password Here”

Now you will Enter into MariaDB Monitor

mysql mariaDB monitor

Step 3: Set network buffer length to a large byte number.

Enter Command: set global net_buffer_length=1000000;

Step 4: Set the maximum allowed packet size to a large byte number.

Enter Command: set global net_buffer_length=1048576;

Step 5: Disable foreign key checking to avoid delays, errors, and unwanted behavior
Enter Command: SET foreign_key_checks = 0;

Step 6: Enter Command: set global max_allowed_packet=1000000000;

Now, To select a MySQL database through CLI?

step 7: Enter Command: use “database_name”;

Step 8: Enter Command: source “SQL File”;

Yay! you are all done, But still, remember to enable foreign key checks when the procedure is complete!

Step 9: Enter Command: SET foreign_key_checks = 1;

The amount of time it takes to import a given SQL file depends on a lot of things. Not only the size of the file, but the type of statements in it, how powerful your server is, and how many other things are running at the same time. We can’t really guess how long it will take to run your SQL script on your server. Be Sure to have patience!

Here are the most useful MySQL batch commands:
Reference: http://dev.mysql.com/doc/refman/5.0/en/mysql-batch-commands.html

Post a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.