Command To Restore And Backup Of MySQL Server
Command to restore and backup 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;
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
Command 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
Check Out : MySQL Error “Too Many Connections”
if you need to have backup in tar file, You will have to specify the method in mysqldump command is
mysqldump –u username –p | gzip/bzip2 > filename.sql
It’s good practice to have backup in compressed form.