How to Import Large Database in MySQL using Commandline (CMD)?

  398 views   6 months ago MySql
Demo Link

in this article, i will share with you how to import a large database in MySQL using the command line. this is a very important topic and tips and it will help you more.

as you know. sometimes you have no access to root users in cPanel, WHM, and AWS then you have no access to increase MySQL database upload limit and you have a very large database and you want to upload it on your live database. so, at that time you have only one and best option to upload your large database in MySQL using the command line.

Step - 1 : Login in your MySQL

first, we need to login to our MySQL using the following command.

<!-- syntax -->
sudo mysql -u mysql_user_name -p
<!-- example -->
sudo mysql -u root -p

Hit the enter after type this command. then the enter your MySQL password after entering the correct password then you can see the following text in your command line.

Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.7.31-0ubuntu0.16.04.1 (Ubuntu)

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


it means you can successfully login in to your MySQL using the CMS.

Step - 2 : Choose your Database

After successfully login the second thing we need to choose our database using the following command.

<!-- syntax -->
use database_name
<!-- example -->
use payment_terminal

after running the above command in your terminal then you can see the following output in your command line.

Database changed

Step - 3 : Import Database

After the chosen database then now how to imports large tables set in our database using the following command.

<!-- syntax -->
source database_file_name_with_path
<!-- example -->
source /home/dell/Downloads/payment_terminal.sql

Hit the above command and wait till your database import process not completed. and it will be a very fast way to import any large database in your MySQL.

i hope you like this article.

Author : Harsukh Makwana
Harsukh Makwana

Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on

Related Articles