How to backup and restore large MySQL databases by Mysqldump

You have come to the best place to learn more about web hosting. Sit back and enjoy our wonderful web hosting tutorials and become an expert in no time!
Post Reply
marcia
Posts: 1
Joined: Tue Nov 14, 2017 11:00 pm

How to backup and restore large MySQL databases by Mysqldump

Post by marcia » Tue Nov 14, 2017 11:02 pm

There are many tools to backup and restore databases like MySQL Dumper, Dumper Spydex, Bigdump or using wordpress plugins like BackWPUp, BackupBuddy and they are really very good. However if your database is too big upto several tens of GB then more common tools will get errors and could not handle them. So I would suggest to backup and restore databases by Mysqldump through the statements.

1. Backup database:


Access with Root account into SSH Server, run this command:

Code:
mysqldump -u username -p[username_password] databasename > /path_to_your_db/databasename_backup.sql
For example: if you backup database with user is root and pass is yourpassword and have the path to your database is /home/example.com/public_html/backup_folder/

Using this command:

Code:
mysqldump -u root -pyourpassword databasename> /home/example.com/public_html/backup_folder/Your_DB_backup.sql
2. Restore database:

Code:
mysql -u username -p[username_password] databasename < /path_to_your_db/databasename_backup.sql
For example, you want to restore database with user is root and pass is yourpassword then using this command

Code:
mysql -u root -pyourpassword databasename < /home/example.com/public_html/backup_folder/Your_DB_backup.sql
If you have other ways to backup and restore big databases easily, please write down.

Good luck!

davber
Posts: 1
Joined: Tue Nov 14, 2017 11:04 pm

Re: How to backup and restore large MySQL databases by Mysqldump

Post by davber » Tue Nov 14, 2017 11:05 pm

Cool hosting guide!

I would check these posts too.

https://forumweb.hosting/14638-how-to-b ... panel.html
https://forumweb.hosting/14096-split-a- ... files.html

They also are good ways to backup and restore mysql databases without using many commands on the terminal.

Hope that helped.

Post Reply