How To Take Mysql Databases Backup with Command line
Today we will discuss on How To Take Mysql Databases Backup with Command line, If you want to take multiple databases backup or all databases backups manually then you can use below steps for that.
Login to server through SSH.
# mkdir /backup/db-backup
create a directory where you want to store backup.
#mysql -e "show databases" > /root/dbbackup.txt
The above command will show all databases and saved the DB name under file /root/dbbackup.txt
# vi /root/dbbackup.txt
Open /root/dbbackup.txt and remove the first 2 lines ( Database, performance_schema & information_schema ) Also you can remove the DB name which is you do not want to take backup.
then use the following
# for database in `cat /root/dbbackup.txt`; do mysqldump $database > /backup/db-backup/$databases.sql;done
Please wait some time and check the DB backups under the /backup/db-backup directory once the process done.