Import MySql dump with progress indicator — Linux

Dejan Blazeski
2 min readSep 9, 2019


We’ll take the default import command and pipe it through withpv

In my tests, on a virtual machine with 2–4GB RAM, the ETA timer was pretty accurate for full mysql dumps with filesize of up to 3GB. If the file is larger, the timer can be off by a bit as slowdown happens.

Anyhow, the import was faster than using a typical mysql import.

Before proceeding, make sure you have pv installed on your linux box so we can monitor the progress.

Importing unzipped mysql dump with progress:

# The command
pv ./mysql-dump.sql | mysql -u user -p databasename

# pv — for monitoring the progress
# mysql-dump.sql — the file we want to import
# user — the mysql user
# -p - will ask for the mysql password
# databasename — the mysql database where we want to import the file

When the file starts importing, you’ll see a progress bar and ETA:

1.13GiB 0:15:26 [10MiB/s] [===========================================>   ] 19% ETA 00:05:38

If your file is gzipped, we can pipe that too, no need to extract first:

# notice the added pipe "gunzip"
pv ./mysql-dump.sql.gz | gunzip | mysql -u user -p databasename

Your file will be unzipped and imported on the fly.

I know, it’s not Mr. Robot level, but close enough.

That’s it.

On an unrelated note, are your Macbook Pro animations lagging? You should try switching to the dedicated (more powerful) graphic card when on power — automate it with this app



Dejan Blazeski

Founder Curious dev. Laravel / Angular / VueJs / React Native / Docker. Love stand up shows.