I know this thread is very old, but it is a valuable resource. I just wanted to point out that the code assumes that the database user has access to all databases when using the option "--all-databases". If this is not the case, then the code will only backup the databases for which the user has permissions. I discovered this after receiving many backups, and it took me a long time to figure out why some of my databases were not being included. There's nothing wrong with the code, and I'm very grateful for it; you just have to know a little about databases to make it work the way you want.