How to split an all databases MySQL dump into separate files for each database?

command-line
bash
mysql

(Dmitry Fedyuk) #1
csplit -f '' -b %02d.sql db.sql /'CREATE DATABASE'/ {*}