I wanted to backup all the MySQL databases I had to retire the actual server and then migrate to a newer server. I had about 50gig of data under /var/lib/mysql/.
How to find the amount of data a of folder have
du -sh /var/lib/mysql/
How to compress and dump all your databases on a MySQL server
#!/bin/sh # Backup and compress your MySQL databases mysqldump -u root -h localhost -p --all-databases | gzip -9 > backup_dbs.sql.gz # Unzip the file when you are ready to import it gunzip backup_dbs.sql.gz