Mysql Import Dump file in Command line

Import MySQL dump file from Command Line

We can export the dump file using mysqldump with the help of the below command

$ mysqldump <database_name> -u<user_name> -p >> sql_export_file.sql

Once you execute the above command the specified database will be exported into sql_export_file.sql. In order to import the dumped Mysql file just follow the below steps.
1. Login to mysql in command prompt with the below command

$ mysql -u root -p

2. Then create new Database to install the dump file.

mysql> create database database_name

3. By executing the above mysql command the specified database will created. To check whether the database is created or not by executing command " show databases ". Now select the database by using mysql command

mysql> use database_name

4. To import the sql file into the current database using mysql command source

mysql> source sql_export_file.sql


Related Topic How to Restore MySQL Database from dump file
List of Mysql Error Code and Description
How to Backup Mysql Database on Command line
How to Restore or Recovering Mysql Database on Command line
How to Create Simple Mysql Database Dump Backup on Ubuntu
SQL  MySQL  

nScraps.com 2011   Privacy Policy  Terms of Service  Feedback