Friday, October 30, 2009

How to take backup of your mysql database

To backup your database.

# mysqldump database_name > backup.sql

For example ninad_ninad is the database name
command will be

#mysqldump ninad_ninad > ninad_ninad_old.sql

backup created in ninad_ninad_old.sql

Now restore it

first create an emtpy database
#mkdir ninad_ninad

Correct ownership
#chown mysql.mysql ninad_ninad

#mysql databasename < backup.sql
it will be
#mysql ninad_ninad < ninad_ninad_old.sql


Thanks
Ninad

No comments:


View My Stats