Last active
August 23, 2023 06:48
-
-
Save froemken/60c522e099831c5b5420e2547dcd90e3 to your computer and use it in GitHub Desktop.
mysqldump command for TYPO3 Databases. It excludes various cache and log tables
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
| #!/bin/bash | |
| PASSWORD=XXXXXX | |
| HOST=XXXXXX | |
| USER=XXXXXX | |
| DATABASE=XXXXXX | |
| DB_FILE=dump.sql | |
| EXCLUDED_TABLES=( | |
| be_sessions | |
| cf_adminpanel_requestcache | |
| cf_adminpanel_requestcache_tags | |
| cf_cache_hash | |
| cf_cache_hash_tags | |
| cf_cache_imagesizes | |
| cf_cache_imagesizes_tags | |
| cf_cache_pages | |
| cf_cache_pagesection | |
| cf_cache_pagesection_tags | |
| cf_cache_pages_tags | |
| cf_cache_rootline | |
| cf_cache_rootline_tags | |
| cf_extbase_datamapfactory_datamap | |
| cf_extbase_datamapfactory_datamap_tags | |
| cf_extbase_object | |
| cf_extbase_object_tags | |
| cf_extbase_reflection | |
| cf_extbase_reflection_tags | |
| cf_extbase_typo3dbbackend_queries | |
| cf_extbase_typo3dbbackend_queries_tags | |
| cf_cache_news_category | |
| cf_cache_news_category_tags | |
| cf_cache_ttaddress_category | |
| cf_cache_ttaddress_category_tags | |
| cf_ttaddress_geocoding | |
| cf_ttaddress_geocoding_tags | |
| fe_sessions | |
| index_fulltext | |
| index_grlist | |
| index_phash | |
| index_rel | |
| index_section | |
| index_stat_search | |
| index_stat_word | |
| index_words | |
| sys_file_processedfile | |
| sys_history | |
| sys_log | |
| sys_refindex | |
| tx_extensionmanager_domain_model_extension | |
| tx_solr_cache | |
| tx_solr_cache_tags | |
| tx_webkitpdf_cache | |
| ) | |
| IGNORED_TABLES_STRING='' | |
| for TABLE in "${EXCLUDED_TABLES[@]}" | |
| do : | |
| IGNORED_TABLES_STRING+=" --ignore-table=${DATABASE}.${TABLE}" | |
| done | |
| echo "Dump structure" | |
| mysqldump --opt --host=${HOST} --user=${USER} --password=${PASSWORD} --no-tablespaces --single-transaction --no-data --routines ${DATABASE} > ${DB_FILE} | |
| echo "Dump content" | |
| mysqldump --opt --host=${HOST} --user=${USER} --password=${PASSWORD} ${DATABASE} --no-tablespaces --no-create-info --skip-triggers ${IGNORED_TABLES_STRING} >> ${DB_FILE} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment