MySQL 导入数据时查看实时进度

1. 安装 pv 工具

pv 全名为 Pipe Viewer,利用它我们可以查看到命令执行的进度,更多功能详见其参数 pv --help

# CentOS
➜ yum install pv

# Ubuntu
➜ sudo apt-get install pv

2. 导出

➜  pv -t -p back_20181109_020001.sql | mysql -uroot -p123123 -D dbname1
Warning: Using a password on the command line interface can be insecure.
0:02:28 [======================================================================================================================>] 100%