Restore And Backup of MySQL Server
MySQL is an open-source database server available in today’s world. It’s important to have a backup of your files and application. It helps you to restore the backup of applications and websites etc according to your need. We can restore and backup of MySQL database using mysqldump command line on Linux.
mysqldump is a command-line interface with the help of you can have a backup of your database.
I have created a test database on my database server and changed the 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 with 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 a backup in a tar file that reduces the size of the database file, You will have to specify the method in mysqldump command Linux.
mysqldump –u username –p | gzip/bzip2 > filename.sql
It’s good practice to have a backup in compressed form.
You’re done restore mysqldump commnad linux mysql backup database