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:

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to Lxadm.com.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.