How to export and import MySQL database using command line Interface
This article will guide you on exporting and importing of MySQL database using command line interface (CLI).
To export MySQL database, open putty on Windows or Terminal in either MAC or Linux OS,
Go to the directory where you want this file to be stored using following command,
Then use below command to export a databse,
>mysqldump --database --user=root --password your_db_name > export_into_db.sql
You will be asked about root password after this command. For windows users who are executing this on their localhost, your password is empty if you ave not set it up. Please direct enter without typing anything.
Now you will get a file named export_into_db.sql in the same directory as you are.
To import a .sql file you need to log into your mysql DBMS first.
Typein : mysql -u root -p and enter. It will ask you your root user's password.
First select the database and then use following command to import the file,
Press enter and your import will start.
Please feel free to post comments if you have any issues.