Last active
June 30, 2023 09:44
-
-
Save probil/6498345a492e06accddc to your computer and use it in GitHub Desktop.
Import mysql database with progress bar and log on error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# import (with pv) | |
pv db_dump.sql | mysql -u <user> -p'<password>' <database> > error.log | |
# import (without pv) | |
mysql -u <user> -p'<password>' <database> < db_dump.sql > error.log | |
# export | |
mysqldump -u <user> -h <host> -p'<password>' <database> | pv > db_dump.sql | |
# export with progress | |
# ================== | |
# to get size you should run: | |
# > SELECT table_schema AS "Database", ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS "Size (MB)" FROM information_schema.TABLES GROUP BY table_schema; | |
# ================== | |
mysqldump -u <user> -h <host> -p<password> <database> | pv --size 100m > db_dump.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ah, well!
Thanks for your help, very appreciates ;-)