Home / Blog / Post
Importing And Exporting Mysql Database With Progress Bar
Added on 21st May 2018 in Tutorial

When importing and dumping mysql databases, it can take a while to perform such tasks and common MySQL clients dont tend to handle large databases quite well, appearing to just hang.

Instead its easier and more informative to perform these actions on the command line and pipe the output through Pipe Viewer, so you can see the progress and estimated completion time.

Install Pipe Viewer

sudo apt-get update
sudo apt-get install pv

Import Database

Replace the uppercase characters with your credentials.

pv FILE.sql | mysql -uUSERNAME -pPASSWORD DATABASENAME

Export Database

Replace the uppercase characters with your credentials and the estimated size of the database.

mysqldump -u USERNAME -pPASSWORD DATABASE | pv --progress --size ESTIMATEDSIZEINGBg -t -e -r -a > DATABASE-dump.sql

Hi there, I am christopher shaw, a software developer form South Yorkshire, England.

I love tinkering with all things tech, and opened this website as a web presence for myself and a place to keep my notes and snippets. Hopefully you will find something here to help

Christopher Shaw