Thursday, January 31, 2019

How to Backup and Restore a MySQL Database

No comments
Hi Dear Friends,

In this post We would like to share infinity knowladge My Good experience and Best solution For .

Laravel Examples

MySQL is a database server for storing data permanently. If you are using MySQL server for an production use, then its necessary to create dataase backup for recovering from any crash. MySQL provides an utility mysqldump for taking backups. In this article you will learn, to taken databases backup in .sql format for archive format. Also we will explain various options for it.

Options for Creating MySQL Databases Backup

You have many options for creating databases backups. read few options below. For this example we have using databse name “mydb”.

1. Full Database Backup in Plain .sql File

 # mysqldump -u root -p mydb > mydb.sql

2. Full Database Backup in Archive .sql.gz File

 # mysqldump -u root -p mydb | gzip > mydb.sql.gz

3. Backup Single Table Only

 # mysqldump -u root -p mydb tbl_student > tbl_student.sql

4. Backup Multiple Databases

# mysqldump -u root -p --databases mydb1 mydb2 mydb3 > mydb1-mydb2-mydb3.sql

5. Backup All Databases

 # mysqldump -u root -p --all-databases > all-db-backup.sql

6. Backup Database Structure Only (no data)

 # mysqldump -u root -p --no-data mydb > mydb.sql

7. Backup Database Data Only (no table structure)

 # mysqldump -u root -p --no-create-info mydb > mydb.sql

8. Backup MySQL Database in XML Format

 # mysqldump -u root -p --xml mydb > mydb.xml

How to Restore MySQL Backup

For restoring databases from backup is quite simple. We use mysql command for it. For example following command will restore all backup from mydb.sql to mydb database.
# mysql -u root -p mydb < mydb.sql
Try this it will help you and for more information click here: Laravel Examples.

Read :

I hope you like this Post, Please feel free to comment below, your Any Idea, suggestion and problems if you face - I am here to Resolve your Any problems.
We hope it can help you...

No comments :

Post a Comment