In this post, I am providing a script to perform Backup and Restore of MySQL Database using Mysqldump.
Mysqldump is an important tool of MySQL Server and it creates a *.sql file with database structure and data. It also includes all possible table lock and object existence script.
I am sharing different syntax and script to perform Backup and Restore of single database or multiple database.
Syntax and Command to take backup of Single Database:
You can execute this using MySQL Command line.
mysqldump -u root -p[root_password] [database_name] > dumpMyFileName.sql
mysqldump -u root -pTestPass MyDatabase > MyDBBackup.sql
Syntax and Command to execute restore of Single Database:
New blank database require to create before any restore operation.
mysqldump -u root -p[root_password] [database_name] < dumpMyFileName.sql
mysqldump -u root -pTestPass NewDatabase < MyDBBackup.sql
Command to take backup of multiple databases:
mysqldump -u root -pTestPass --databases MyDB1 MyDB2 > MultipleDB.sql
Command to take backup of all databases:
mysqldump -u root -pTestPass --all-databases > All.sql
Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.
If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.
I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.