-
-
Save andrejIka/7ed56625e86b1e1faf90fa15658c51da to your computer and use it in GitHub Desktop.
Speed up wp db export using WP-CLI
This file contains 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
# Export site database using wp db export | |
wp db export /wp-content/wordpress-dump.sql --all-tablespaces --single-transaction --quick --lock-tables=false | |
# Gzip compress the recent database export | |
gzip wordpress-dump.sql | |
# Export sites database using wp db export and gzip compress | |
wp db export --all-tablespaces --single-transaction --quick --lock-tables=false - | gzip -9 - > wordpress-dump.sql.gz | |
lukecav commented on Jan 7, 2019 | |
https://guides.wp-bullet.com/how-to-export-large-wordpress-databases-and-speed-up-the-process/ | |
https://stackoverflow.com/questions/5666784/how-can-i-slow-down-a-mysql-dump-as-to-not-affect-current-load-on-the-server | |
https://developer.wordpress.org/cli/commands/db/export/ | |
@dustinrue | |
dustinrue commented on Sep 26, 2022 | |
FWIW you can gzip it on the fly and save the last step | |
wp db export --all-tablespaces --single-transaction --quick --lock-tables=false - | gzip -9 - > wordpress-dump.sql.gz | |
The - in the command will output the stream to stdout which is piped to gzip. gzip -9 will apply max compression and then stream that to stdout, which is redirected to the final file | |
@michael-sumner | |
michael-sumner commented on Sep 5, 2023 | |
Thanks @dustinrue it worked like a charm! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment