Last active
March 3, 2020 17:11
-
-
Save Rud5G/4739140 to your computer and use it in GitHub Desktop.
1. set host+user+pass+db 2. dump without logs, etc.3. tail for completed (check dump)4. dump logs structure, etc.5. tail for completed (check dump)6. compress ps: possible to set the password to empty string? (which asks for the password on commandline). (= not tested).
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 MySQLDUMP_HOSTNAME= | |
export MySQLDUMP_USERNAME= | |
export MySQLDUMP_DATABASE= | |
export MySQLDUMP_PASSWORD= | |
export MySQLTABLE_PREFIX= | |
mysqldump -p$MySQLDUMP_PASSWORD -h$MySQLDUMP_HOSTNAME -u$MySQLDUMP_USERNAME ${MySQLDUMP_DATABASE} \ | |
--ignore-table=${MySQLDUMP_DATABASE}.${MySQLTABLE_PREFIX}core_cache \ | |
--ignore-table=${MySQLDUMP_DATABASE}.${MySQLTABLE_PREFIX}core_cache_tag \ | |
--ignore-table=${MySQLDUMP_DATABASE}.${MySQLTABLE_PREFIX}log_url \ | |
--ignore-table=${MySQLDUMP_DATABASE}.${MySQLTABLE_PREFIX}log_url_info \ | |
--ignore-table=${MySQLDUMP_DATABASE}.${MySQLTABLE_PREFIX}log_visitor \ | |
--ignore-table=${MySQLDUMP_DATABASE}.${MySQLTABLE_PREFIX}log_visitor_info \ | |
--ignore-table=${MySQLDUMP_DATABASE}.${MySQLTABLE_PREFIX}log_customer \ | |
--ignore-table=${MySQLDUMP_DATABASE}.${MySQLTABLE_PREFIX}log_quote \ | |
--ignore-table=${MySQLDUMP_DATABASE}.${MySQLTABLE_PREFIX}report_event \ | |
--ignore-table=${MySQLDUMP_DATABASE}.${MySQLTABLE_PREFIX}report_viewed_product_index \ | |
--ignore-table=${MySQLDUMP_DATABASE}.${MySQLTABLE_PREFIX}index_event \ | |
--ignore-table=${MySQLDUMP_DATABASE}.${MySQLTABLE_PREFIX}index_process_event \ | |
--ignore-table=${MySQLDUMP_DATABASE}.${MySQLTABLE_PREFIX}dataflow_batch_export \ | |
--ignore-table=${MySQLDUMP_DATABASE}.${MySQLTABLE_PREFIX}dataflow_batch_import \ | |
> "mysqldb-${MySQLDUMP_DATABASE}.sql"; | |
tail -n1 mysqldb-${MySQLDUMP_DATABASE}.sql ; | |
mysqldump -p$MySQLDUMP_PASSWORD -h$MySQLDUMP_HOSTNAME -u$MySQLDUMP_USERNAME ${MySQLDUMP_DATABASE} \ | |
--no-data \ | |
${MySQLTABLE_PREFIX}core_cache \ | |
${MySQLTABLE_PREFIX}core_cache_tag \ | |
${MySQLTABLE_PREFIX}log_url \ | |
${MySQLTABLE_PREFIX}log_url_info \ | |
${MySQLTABLE_PREFIX}log_visitor \ | |
${MySQLTABLE_PREFIX}log_visitor_info \ | |
${MySQLTABLE_PREFIX}log_customer \ | |
${MySQLTABLE_PREFIX}log_quote \ | |
${MySQLTABLE_PREFIX}report_event \ | |
${MySQLTABLE_PREFIX}report_viewed_product_index \ | |
${MySQLTABLE_PREFIX}index_event \ | |
${MySQLTABLE_PREFIX}index_process_event \ | |
${MySQLTABLE_PREFIX}dataflow_batch_export \ | |
${MySQLTABLE_PREFIX}dataflow_batch_import \ | |
>> "mysqldb-${MySQLDUMP_DATABASE}.sql"; | |
tail -n1 mysqldb-${MySQLDUMP_DATABASE}.sql ; | |
gzip mysqldb-${MySQLDUMP_DATABASE}.sql ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, And how about removing the triggers definers from the file as well?
Currently I have to manually run this command:
sed -E 's/DEFINER=
[^
]+@
[^]+
/DEFINER=CURRENT_USER/g' my_db_dump.sql > my_db_dump.sql.portable.sql