Progress bar: Dump and restore mysql database with progress bar.

Showing progress bar while dumping or restoration of the dump, would be a handy tool. Here is how you do it.

You can achieve with  pipe viewer.

#apt-get install pv

An you may use the pv as shown in the image below to restore the database from a backup file..

# pv database.sql | mysql -u uname -p databasename





And to backup the database to a sql file with pv, use the following command.
#mysqldump -u username -p databasename | pv -W > database.sql

Compress the database file in gzipped version of the sql file
#mysqldump -u username -p databasename | pv -W | gzip > database.sql.gz

Restore the gzipped file
#pv database.sql.gz | gunzip | mysql -u root -p databasename

Comments

Post a Comment

Popular posts from this blog

Solution to Moodle Error: Coding error detected, it must be fixed by a programmer: Failed to unserialise data from file. Either failed to read, or failed to write.

ACTION_FAILED:OU_INVALID: Solution for GoogleApps bulk user upload issue, username@domainname.com:ACTION_FAILED:OU_INVALID. This error is because you have not specified the Org Unit Path properly.

(Solved) (Fixed )MariaDB Unmet Dependencies on Ubuntu 20.04.