MySQL DBA Tutorial - How to Restore Database from backup in MySQL Server

Scenario:


You are working as MySQL DBA and you have taken the full backup of a database by using mysqldump utility, Now you need to restore that backup to database, how would you do that?


Solution:

To take full backup of a database in MySQL  , below mysqldump command can be used.
shell > mysqldump --user=YourUserName --password=PasswordfortheUser DatabaseName >/DestinationDirectory/BackupFileName.sql
Let's say if you have a database name testdb and you would like to take full backup, you can use below command

shell > mysqldump --user=root --password=DBA123 testdb >/mysqlbackup/testdb.sql

To Restore, you will be using below command. Make sure you have created empty database first , otherwise you will get an error.

shell > mysql --user=UserName --password=PasswordforUser DatabaseName < /SourceDirectoryforBackup/BackupFile.sql
Let's say if we would like to restore testdb, I can use below statement.
shell > mysql --user=root --password=DBA123 testdb < /mysqlbackup/testdb.sql


MySQL DBA Tutorial - Restore Database from mysqldump file


15 comments:

  1. Can you please share the video how to do the point in time recovery in mysql 8.0.16 in linux

    ReplyDelete
  2. There’s never been a better time to sell online. Find out how our solutions can help your business save time, save on sending1 and deliver a winning customer experience fulfilment services uk.To process orders faster, keep packaging handy and ready to send.Visit this for tools, solutions and support to help make your small business shine.

    ReplyDelete
  3. download game guardian apk from eagleapk. best site that is providing amazing mod apks and games freely on website for everyone.

    ReplyDelete
  4. Febrile seizure in children or febrile convulsion is the most common neurological complication that occurred in late infancy and early childhood! See more!

    ReplyDelete
  5. visit our website to play Slotxo game online. best game in 2021

    ReplyDelete
  6. Can you guys help me out in fixing this ui?

    ReplyDelete
  7. Now coming to the point for eye makeup remover this is the best according to surveyor.

    ReplyDelete
  8. Mothers mainly place an especially lofty value on sons as a result of their relationship with them. It is the utmost desire of every parent to select a sentimental gift for their sons.
    Son day

    ReplyDelete
  9. Here are some suggestions for Automate assignment of production tasks by crop
    Centralize staff communications with notifications and reminders.

    ReplyDelete
  10. Here are some suggestions for horticulture software Automate assignment of production tasks by crop
    Centralize staff communications with notifications and reminders.

    ReplyDelete
  11. The cleaning head comes with LED headlights that will let you see mold residing in the carpet and darker places. Therefore, no corners can stay uncleaned.

    Its ability to deep clean carpets makes it the best HEPA vacuum. It can exceptionally pick finely small particles such as mold, dirt, and debris from various carpeted spaces.
    https://10bestvacuums.com/

    ReplyDelete
  12. Leopard Print Linen cushion Euro size, Super thick leopard print linen with lush thick cotton fringe trim and black velveteen backing.

    ReplyDelete
  13. Master of PC in online every time on this site you can get every paid software in free of cost.

    ReplyDelete
  14. internet download manager kuyhaa now for everyone at the very best package as this package is 100% Free.

    ReplyDelete