Restore & Backup Of Mysql Server On Redhat/CentOs 7

0
26
views

Mysql is an open source database server available in today’s costly world. It’s important to have a backup of your files and application. It helps you to restore the backup of applications and website etc according to your need.

MysqlDump is a tool or command line interface with the help of you can have backup of your files.

Let’s assume

I have created a test database on my database server and changed database.

create database test;

mysql

For backup

The command is mysqldump –u username –p [database_name]  >  filename.sql

mysqldump -u root -p  test > testdb.sql

Now backup has been created

backup created

For Restore

The command is  mysql –u  username –p [database_name] < filename.sql

The above command is to take only one database if you want all database backup together the you can use this command

mysqldump –u username –p  –all-database > filename.sql

if you need to have backup in tar file, You will have to specify the method in mysqldump command

The command is mysqldump –u username –p | gzip/bzip2  > filename.sql

It’s good practice to have backup in compressed form.

You’re done

LEAVE A REPLY

Please enter your comment!
Please enter your name here