Importing Database in MySQL from a sql dump file

First create a dump or .sql file of the database you want to take back up of. Then transfer it to the computer on which you want to import the data (if the file is not on that computer). Now follow these steps:

Open terminal and then do the following:

1.Login to MySQL as root:

mysql -u root -p;


2.Then create a database, say dbname using:

create database dbname;

3.Use the database created:

use dbname;

4.Import the MySQL dump file:

source pathofsqlfile.sql

Here pathofsqlfile.sql is the absolute path of the sql dump file (you can also give relative path if the sql dump file is in mysql directory itself)

Advertisements

4 thoughts on “Importing Database in MySQL from a sql dump file

  1. You have really received a great informative post here. I appreciate studying this type of material. I share many of your same ideas on this topic. I appreciate the effort you put into this short article.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s