This is a short tutorial on how to show MySQL import progress using an app called Pipe Viewer. It’s very easy to install and use, but there is a few points which require explanation, so I will describe them here. I will also show examples on how to use this tool.
Installation
Installation differs based on your Linux operating system.
Linux distribution | Installation procedure |
---|---|
Ubuntu/Debian | apt-get install pv |
Fedora | yum install pv |
CentOS/RHEL | Set up ivarch YUM repository or use RepoForge, then do “yum install pv“ |
List of all supported operating systems, together with an installation description, can be found here: https://www.ivarch.com/programs/pv.shtml
Usage
Pipe Viewer is used by adding “pv your_sql_file.sql |” in front of your original query. You also have to remove the ending part – sign < and everything that follows. The easiest command could look like this:
pv my_sql_file.sql | mysql -u root -h localhost -p my_database
This will append a progress bar with detailed information about your action, directly into terminal.
