How to take backup of database and restore using command

How to take backup of database and restore using command


I was involved in working on databases using MySQL and recently i was required to re-create DB on different machine. So either you can create it from scratch or take the backup of DB from one machine and restore it on other machine which saves time. Also its a practice to take backup on regular basis.
To to this we can use below command.


To take DB backup
=============================================
-> mysqldump database_name > database_name.sql

**Make sure to keep the db name same.



To Restore DB backup
=============================================
->mysql database_name < database_name.sql


You will have the DB ready on new Box/machine in few minutes with same replica.


That's it.


No comments:

Post a Comment

Android : How to connect your Android device over Wifi using ADB command for App debugging

How to connect your Android device over Wi-Fi using ADB command Sometimes it requires to connect your Android dev...