How to take a backup/restore a mysql database from command line?

Mysql Database Restore

Compression [ Backup ]

mysqldump DatabaseName > DatabaseName.sql
ll DatabaseName.sql


Create Database Name in Mysql

create databasename;
user databases;

[Put the database backup under root directory]

mysql DatabaseName < DatabaseName.sql

mysql -u root -pWEKBxrBV travelblog_trv2blg < travelblog_trv2blg.sql


Restore from the root

1) mysqladmin drop database-name;
2) mysqladmin create database-name;
3) mysql database-name < database-name.sql

  1. Leave a comment

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: