Forrest logo
back to the pv tool

mysql:database:dump:with-progress-bar

Import a MySQL dump with progress bar into a MySQL server
$ pv ${mysql_dump_path} | mysql -u ${username} -p ${database_name}
try on your machine

This command imports a MySQL database dump file by using the "pv" command to display the contents of the file, which is then piped to the "mysql" command.

The variables in the command are:

  • ${mysql_dump_path}: This specifies the path to the MySQL database dump file that is to be imported.
  • ${username}: This specifies the MySQL user that has the necessary permissions to import the database.
  • ${database_name}: This specifies the name of the database to which the data in the dump file is to be imported.

When the command is executed, the "pv" command reads the contents of the dump file and displays them, while the "|" (pipe) operator passes the output to the "mysql" command. The "mysql" command connects to the MySQL server and imports the data into the specified database using the provided username and password.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the pv tool