import a gzipped database backup

I’ve been gunzipping my MySQL dumps before importing them.  This was always mildly annoying – especially when working on Drupal projects where the database seems to get passed around a lot.

Today I found a more concise approach: use gzcat to read the contents of the gzipped file directly into your database like this:

gzcat path/to/dump.gz | mysql -uroot -p database_name

* change the italicized text to the path to your backup file, MySQL user and database name, respectively.

Comments are closed.