May 4, 2015

Viewing the progress of a MySQL command line Import

khallmark @ 4:20 pm —

Instead of importing from a dump file like this:

mysql -uxxx -pxxx dbname < /sqlfile.sql

You can use a utility called “pv” (pipe viewer) to view the progress of an import. This will show you a nifty progress bar that will let you see the estimated progress through the file. This program works by reading each line of the file, updating the progress bar, and passing the line of SQL code to the MySQL console.

pv sqlfile.sql | mysql -uxxx -pxxxx dbname

You can install the command in an Ubuntu environment using the command:

sudo apt-get install pv

or you can install it on a Mac using MacPorts with the command:

sudo port install pv

Leave a Reply

Logged in as . (Logout)