SUPPORT THE SITE WITH A CLICK

Subscribe Rss:

SUPPORT THE SITE WITH A CLICK

Monday, August 18, 2008

Back Up and Restore a MySQL Database

Back up From the Command Line (using mysqldump)


Taking mysql backup from terminal is as simple.
$ mysqldump --opt -u [uname] -p[pass] [dbname] > [backupfile.sql]

uname -username
p -password
dbname-database
opt -mysqldump option

Ex: mysqldump -u root -p Tutorials > tut_backup.sql



Taking the backup of a table


With mysqldump command you can specify certain tables of your database you want to backup.

Ex: mysqldump -u root -p Server user role > tab_backup.sql


here Server is the database name,user & role are the tables in Server database.


Taking the backup of more than one database



mysqldump -u root -p --databases Users Articles Comments > content_backup.sql



Restoring your MySQL Database



Ex: mysql -u root -p Users < tut_backup.sql

No comments :

Post a Comment