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.
I have created a test database on my database server and changed database.
create database test;
The command is mysqldump –u username –p [database_name] > filename.sql
mysqldump -u root -p test > testdb.sql
Now backup has been created
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.