How to monitor the Restore progress in MySQL or MariaDB

Scenario:

You are working as MySQL/ MariaDB database administrator.  You need to restore / import large backup file to database and would like to monitor the progress of restore. Which tools you can use to monitor the restore progress in MySQL / MariaDB?

Solution:

In our backup monitor progress posts, we mentioned that you need to install PV (Pipe Viewer). Check the link here.
Once the PV is installed you can use below command to import / Restore and monitor progress.

pv /SourceDirectory/sqlfile.sql | mysql -uUserName -pPassword dbname

If I need to restore abc database from exiting abc.sql file. I can use below command.

pv /mysqlbackup/abc.sql | mysql -u root -pDBA123 abc

For demo, check the video : How to monitor MySQL or MariaDB restore progress. 

2 comments: