MySQL – Backup and Restore All Databases

I recently used this to backup and restore all the databases in one single file. This works for small sized databases very well and is a quick and easy way to backup and restore all local databases. Very useful for testing and quick restore. Issue this command at the command prompt.

mysqldump -u <username> -p --all-databases > all_databases.sql

Restore all databases by logging in to mysql with

mysql -u <username> -p

SOURCE all_databases.sql (if you are in the directory with all_databases.sql or prepend the path)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s