I\'m writing a single line command that backups all databases into their respective names instead using of dumping all in one sql.
Eg: db1 get saved to db1.sql and
This is what I am using, it's very simple and works fine for me.
mysql --skip-column-names -u root -p -e 'show databases' | while read dbname; do mysqldump --lock-all-tables -u root -p "$dbname"> "$(date +%Y%m%d)-$dbname".sql; done
With compression option:
mysql --skip-column-names -u root -p -e 'show databases' | while read dbname; do mysqldump --lock-all-tables -u root -p "$dbname" | gzip> /tmp/"$(date +%Y%m%d)-$dbname".sql.gz; done
If you didn't add the password in the command, you need to type it one plus the total number of the databases you have.