Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I often import MySQL databases, and this can take a while. There is no progress indicator whatsoever. Can one be shown, somehow? Either records imported, MB imported, or tables imported... anything is better than just waiting. Anybody any idea?

I use this command:

mysql -uuser -p -hhost database < largefile.sql

Files are between 40-300 MB, and the host is within the local network.

share|improve this question
4  
    
@sr_ I think pv is exactly what the questioner searches for. I just installed it on CentOS via rpmforge. If given the size-parameter it will even show an ETA. –  Nils Apr 18 '12 at 19:13
    
pv did the trick indeed! If somebody can make this an answer, I can accept this! –  user Jun 14 '12 at 11:34
add comment

2 Answers

up vote 8 down vote accepted

There is nice tool called pv

# On Ubuntu/Debian system
$ sudo apt-get install pv

# On Redhat/CentOS
$ sudo yum install pv

then e.g. you can use it like this

$ zcat dbpackfile.sql.gz | pv -cN zcat | mysql -uuser -ppass dbname

ps: check this blog http://blog.larsstrand.org/2011/12/tip-pipe-viewer.html

UPDATE: seems like above link is broken but I found same article here http://blog.larsstrand.no/2011/12/tip-pipe-viewer.html

share|improve this answer
add comment

I always import databases from the MySql shell. It does not provide a progress indicator, but it does (quickly) scroll the actions it is performing so I know it's working.

# mysql -u user -p -h host database
> source /path/to/some/largefile.sql;
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.