Skip to content

Instantly share code, notes, and snippets.

@h3nn3s
Created February 27, 2019 06:55
Show Gist options
  • Save h3nn3s/da77efd070ab00d6890e7780ab25a8f7 to your computer and use it in GitHub Desktop.
Save h3nn3s/da77efd070ab00d6890e7780ab25a8f7 to your computer and use it in GitHub Desktop.
Dump TYPO3 Database without Caches and Userdata
#!/bin/bash
# This script dumps all neccessary tables for LOCAL Development
# Be aware, that it excludes all userdata, caches and environment
# specific tables!
PASSWORD=
HOST=
USER=
DATABASE=
DB_FILE=dump-without-userdata-caches.sql
EXCLUDED_TABLES=(
fe_session_data
fe_sessions
fe_users
cache_imagesizes
cache_md5params
cache_treelist
cache_typo3temp_log
cf_cache_hash
cf_cache_hash_tags
cf_cache_news_category
cf_cache_news_category_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_extbase_typo3dbbackend_tablecolumns
cf_extbase_typo3dbbackend_tablecolumns_tags
cf_workspaces_cache
cf_workspaces_cache_tags
index_debug
index_fulltext
index_grlist
index_phash
index_rel
index_section
index_stat_search
index_stat_word
index_words
tx_blog_domain_model_comment
tx_formhandler_log
tx_powermail_domain_model_answer
tx_powermail_domain_model_mail
tx_realurl_pathdata
tx_realurl_uniqalias
tx_realurl_uniqalias_cache_map
tx_realurl_urldata
)
IGNORED_TABLES_STRING=''
for TABLE in "${EXCLUDED_TABLES[@]}"
do :
IGNORED_TABLES_STRING+=" --ignore-table=${DATABASE}.${TABLE}"
done
echo "Dump structure"
mysqldump --host=${HOST} --user=${USER} --password=${PASSWORD} --single-transaction --no-data ${DATABASE} > ${DB_FILE}
echo "Dump content"
mysqldump --host=${HOST} --user=${USER} --password=${PASSWORD} ${DATABASE} ${IGNORED_TABLES_STRING} >> ${DB_FILE}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment