How to restore Large MySQL databases on Linux

MySQL Database restore and Table restore.


There are many ways to restore a SQL database to MySQL. But most of the methods allow maximum of 200 MB file to be restored.
But when it comes to restore more than 2Gig file, it more frustration.
This method is simple, no other complex scripts.
Steps are
1. connect to the MySQL server via SSH
2. Login to MySQL server
mysql -u user -p password
3. At MySQL prompt type
use database_to_be_restored;
4. then type source followed by the path to the mysql restore file.
Ex.
use test_db;
source /tmp/test1_db.sql
4. It takes some time depends on size of the restore database. If the DB is about 2Gig size, restore process will run for 2 to 3 minutes.
There is an another use with this method.
If anyone want to restore some tables from backup database, this method is very handy.
Just copy the selected tables to new database and restore.
Or just override the existing one, it will only update new tables, everything else will be considered as duplicates and won't get update.


Note: I use this method to restore very large databases up to maximum size of 5Gig.
Download As PDF

No comments:

Post a Comment