Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement a MySQL dump/restore progress bar? [closed]

I am having trouble using MySQL's built-in progress reporting method for dumping to a file.

According to this, a patch was committed to mysqldump.exe over a year ago that would print progress to the command line every so many lines if mysqldump was invoked with the options --verbose and --show_progress_size. However, when I run the command

mysqldump -u <user> -p<password> --verbose --show_progress_size <database_name> > "C:\thingy.sql"

I get the error message below:

mysqldump: unknown option '--show_progress_size'

I am unable to find any record of this option being removed from mysqldump. I am using version 5.1.58 of MySQL community server, with mysqldump at Ver 10.13.

If this feature has indeed been removed, then I am looking for a way to implement an accurate progress bar for dumps and restores.

like image 750
lettucemode Avatar asked Jan 10 '12 16:01

lettucemode


1 Answers

It seems like version 10.13 of mysqldump has been released in 2009 or earlier (to see for yourself, search for "10.13" in this bug report and have a look at the corresponding MySQL version) and is still being used in the latest version of MySQL. So the patch probably hasn't been released yet. It might be worth a try to update to a current version of MySQL, though.

I take it that you're using Windows. In case I'm wrong and you're on Linux, you could read your dump file using pv:

pv --bytes --eta --progress dump_file | mysql --some-option

This will give you some sort of progress bar, although it sometimes lags behind. Unfortunately, I haven't yet managed to use pv during dumping to a file, but maybe this information helps you anyway.

like image 103
mzuther Avatar answered Oct 05 '22 02:10

mzuther