MySQL Database Backup using mysqldump command.
·
MySQL provide a great
command line utility to take backup of your MySQL database and restore it. mysqldump
command line utility is available with MySQL installation (bin directory)
that can be used to achieve this.
1.
Getting backup of a MySQL database using mysqldump.
Use following command line for
taking backup of your MySQL database using mysqldump utility.
mysqldump
–u[user name] –h[hostname] –p[password] [database name]
> [dump file]
|
Example:
mysqldump –uroot –hlocalhost –prootpassword
test > D:/test.sql
|
2.
Restoring MySQL database.
The mysqldump utility is used only
to take the MySQL dump. To restore the database from the dump file that you
created in previous step, use mysql command.
mysql
-u[username] –h[hostname] –p[Password] [database name] < [dump file]
|
Example:
mysql
-uroot –hlocalhost -prootpassword test < D:/test.sql
|
|
Do you know the other uses of
mysqldump utility?