We’ll take the default import command and pipe it through with
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
pvinstalled 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.