MySQL: split whole database dump into separate databases

If you have dumped all MySQL databases into one file (mysqldump --all-databases), you may have issues restoring a single database from that file.


You can use awk to split the whole database dump into separate databases.

  • first save this script
  • and then run it against all_dbs.sql file: