How To Import MYSQL / SQL Database Files Into MySQL Using Command Line

If you are a web developer or software developer, This is very important tricks that you must know.   Most of developers are faced to this issue when they trying to upload their database file using PHPMyAdmin. I will guide you to upload your database quickly also without getting any error.

First I recommend to use your MySQL as a global variable.   It will help you to run your MySQL command anywhere that you want. for that,

01 install xampp or wamp.

02.If you are use xampp navigate to c => xampp =>MySQL => bin

03.copy your path clicking the  navigate bar.

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

If you couldn’t do this correctly. don’t worry. just navigate to c drive then.

cd xampp/ mysql/bin using cmd.


now you can run mysql.exe -u root  -p

after the -u it will take your localhost db use name  as per my root.

then I can log into my localhost db. now I can run cli command using command line.
then we have to create new database;

CREATE database MY_SQL_Database;

now we have database.then we can browse our database.
We can easily  navigate to our database using below command.
use MY_SQL_Database

now its ready for upload our database file. type bellow command.

SOURCE sqlfile_name.sql

if you can run this command within a few minutes, your database will be imported to your local server.

Leave a Reply

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