TECHONOLGY

How to Backup and Restore MySQL Database

Written by Alex

Introduction

It is essential to big to form regular backups of all data just in case of loss. Has your MySQL database has been lost, and you’re scrambling to revive a replica from your last backup? In this tutorial, we will let you know How to Backup and Restore MySQL Database with two easy ways.

Prerequisites

  • A Linux operating system
  • MySQL installed
  • An existing database
  • Mysqldump utility (should be included with your MySQL software)

MySQL Database Backup from the Command-Line with mysqldump

mysqldump can dump a database including the SQL statements required to rebuild the database. By default, the dump file includes the SQL commands to revive the tables and data.

For taking MySql Db backup we use the following command

> mysqldump -u (username) -p (dbname) > (dbname).sql

Then Type the password for user and backup will be completed.

How to Restore MySQL database

Step 1 : Create a New Database

> create database (dbname);

How to Backup and Restore MySQL Database

Step 2 : Connect to Mysql on the server using MySQL password.

# mysql -u root -p

Step 3: No we will switch to the newly created database.

> use (dbname);

Step 4: Restore DB backup in the new database.

> source /path/db

How to Backup and Restore MySQL Database

Step 5 : Verify contents of db using below command for example.

>show tables;

So you are able to do that how to backup and restore MySQL Database using mysqldump.

Conclusion

Now you Know How to Backup and Restore MySQL Database using mysqldump with all the above commands.

We hope you are like this article and this is useful for you. If you learn more about Linux, AWS Tips, and Tricks Please Bookmark this Website. We are Daily Publish New Article in this Website WWW.BPMTECHGURU.IN and all post on this website is practically tested and 100% Work if you have any Problem Please Drop a Comment we are trying to resolve your problem.

About the author

Alex

Leave a Comment