Database

How to do Backup and Restore on MySQL

It’s easy to do backup & restore on MySQL.
The simplest way to do it, you can use mysqldump
Here it is

To backup

go to $MYSQL_HOME/bin

#mysqldump -u username -p password -B database_name >> sqlfile.sql

To restore

– enter your mysql database
– create the database
– use the database
– source sqlfile.sql

For example :

I have employee database on mysql
My MySQLusername & password are admin/4dm1n82

To backup
#mysqldump -u admin -p4dm1n82 -B employee >> emp.sql

To restore to the other machine
mysql>create database employee;
mysql>use employee;
mysql>source emp.sql

Simple !!! 🙂

Advertisements

Discussion

One thought on “How to do Backup and Restore on MySQL

  1. Hey Thanks for the great tip! Though backup and restore is not really my Fav task! I use Timeline to make my life easier!

    Posted by sama86 | June 30, 2010 10:03:10, 10:03 am

Leave a Reply

Please log in using one of these methods to post your comment:

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

Archives

Twitter Updates

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

%d bloggers like this: