{"id":697,"date":"2016-09-06T09:26:41","date_gmt":"2016-09-06T03:56:41","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=697"},"modified":"2026-08-07T09:56:58","modified_gmt":"2026-08-07T04:26:58","slug":"script-to-take-tablewise-mysqldump-and-store-in-s3","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/script-to-take-tablewise-mysqldump-and-store-in-s3\/","title":{"rendered":"Automate MySQL Table-Level Backups to Amazon S3 with Encryption"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">Introduction<\/h1>\n\n\n\n<p>Backing up MySQL databases is one of the most critical responsibilities for database administrators and DevOps engineers. While full database backups are useful, there are many scenarios where backing up <strong>individual tables<\/strong> provides greater flexibility, faster recovery, and reduced storage consumption.<\/p>\n\n\n\n<p>In this guide, you&#8217;ll learn how to automate <strong>table-level MySQL backups<\/strong>, compress and encrypt each backup using <strong>AES-256 encryption<\/strong>, upload them to <strong>Amazon S3<\/strong>, and automate the entire process using a Bash script.<\/p>\n\n\n\n<p>By the end of this tutorial, you&#8217;ll have a reliable backup workflow suitable for production environments.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Why Take Table-Level MySQL Backups?<\/h1>\n\n\n\n<p>Traditional database dumps create a single SQL file for an entire database. While this works well for small databases, restoring a single table from a large dump can be time-consuming.<\/p>\n\n\n\n<p>Backing up tables individually offers several advantages:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Faster restoration of individual tables<\/li>\n\n\n\n<li>Easier troubleshooting<\/li>\n\n\n\n<li>Reduced recovery time<\/li>\n\n\n\n<li>Better organization of backups<\/li>\n\n\n\n<li>Independent versioning of tables<\/li>\n\n\n\n<li>Compatible with Amazon S3 Versioning<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Solution Overview<\/h1>\n\n\n\n<p>The backup workflow performs the following actions:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Connects to the MySQL server.<\/li>\n\n\n\n<li>Retrieves all available databases.<\/li>\n\n\n\n<li>Retrieves every table within each database.<\/li>\n\n\n\n<li>Creates a compressed dump for each table.<\/li>\n\n\n\n<li>Encrypts each dump using AES-256.<\/li>\n\n\n\n<li>Uploads the encrypted backup to Amazon S3.<\/li>\n\n\n\n<li>Removes temporary local backup files.<\/li>\n\n\n\n<li>Sends a backup summary (optional).<\/li>\n\n\n\n<li>Cleans up older local backups.<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Prerequisites<\/h1>\n\n\n\n<p>Before running the script, ensure the following components are installed and configured.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. MySQL Client Utilities<\/h2>\n\n\n\n<p>Install MySQL client tools including <code>mysqldump<\/code>.<\/p>\n\n\n\n<p>Verify installation:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ mysqldump --version<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">2. AWS CLI or S3 Client<\/h2>\n\n\n\n<p>Although the original script uses <strong>s3cmd<\/strong>, AWS CLI v2 is recommended for new deployments.<\/p>\n\n\n\n<p>Verify installation:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ aws --version<\/code><\/pre>\n\n\n\n<p>or<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ s3cmd --version<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">3. Amazon S3 Bucket<\/h2>\n\n\n\n<p>Create an S3 bucket for backups.<\/p>\n\n\n\n<p>Recommended settings:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Versioning Enabled<\/li>\n\n\n\n<li>Server-side encryption enabled<\/li>\n\n\n\n<li>Lifecycle policies configured<\/li>\n\n\n\n<li>Private bucket<\/li>\n\n\n\n<li>Block Public Access enabled<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">4. IAM Permissions<\/h2>\n\n\n\n<p>Grant the backup server permissions to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Upload objects<\/li>\n\n\n\n<li>List bucket contents<\/li>\n\n\n\n<li>Read objects (for restoration)<\/li>\n\n\n\n<li>Delete old backups (optional)<\/li>\n<\/ul>\n\n\n\n<p>Avoid using the root AWS account for backup automation.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">5. MySQL Credentials<\/h2>\n\n\n\n<p>Create a MySQL user with backup privileges.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ GRANT SELECT, SHOW VIEW, EVENT, TRIGGER ON <em>.<\/em> TO 'backupuser'@'localhost';\n$ FLUSH PRIVILEGES;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Backup Script Features<\/h1>\n\n\n\n<p>The script automatically:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Discovers all databases<\/li>\n\n\n\n<li>Creates table-wise dumps<\/li>\n\n\n\n<li>Compresses backups using gzip<\/li>\n\n\n\n<li>Encrypts using AES-256<\/li>\n\n\n\n<li>Uploads encrypted backups to Amazon S3<\/li>\n\n\n\n<li>Deletes temporary backup files<\/li>\n\n\n\n<li>Generates backup logs<\/li>\n\n\n\n<li>Sends email notifications (optional)<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Backup Script<\/h1>\n\n\n\n<p>Below is the complete Bash script.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/sh\n# support@pheonixsolutions.com\n# script to take tablewise backup and upload it to a versioning enabled s3 bucket.\n\ns3cmd --version &amp;> \/dev\/null;\nif &#91; $? -ne 0 ]; then\n    echo -e \"s3cmd not found; Please install s3cmd\"\n    exit 0;\nfi\n\nS3BACKUP=\"s3-bucket-name\";\nDB_USER=root\nDB_PASS=\"DBPassword\"\nBASE_BAK_FLDR=\/backup\/sqldailybackups\nDATA=`date|shasum|base64|head -c 16`\nBACKUP_LOG=$BASE_BAK_FLDR\/sqlbackuplog\nFROM_EMAIL='from-email@domain.tld'\nTO_EMAIL='to-email@domain.tld'\n\nif &#91; -d \/backup\/sqldailybackups\/]; then\n    echo -e \"Backup folder : \/backup\/sqldailybackups\/\";\nelse\n    mkdir -p \/backup\/sqldailybackups\/\nfi\n\n> $BACKUP_LOG\n\nDBS_LIST=$(echo \"show databases;\"|mysql -u $DB_USER $DB_PASS -N 2>> $BACKUP_LOG)\n\nif &#91; -z \"$DATA\" ]; then\n    echo -e \"Base64 Failed: Hash Empty\"| mail -r $EMAIL -s \"SQL backup failed : `date` : $TO_EMAIL;\n    exit 0;\nfi\n\necho -e \"`date` : $DATA\" >> $BASE_BAK_FLDR\/..\/logdate_\n\nOIFS=$IFS; IFS=$'\\n'\n\nfor DB in $DBS_LIST; do\n    DB_BKP_FLDR=$BASE_BAK_FLDR\/$(date +%d-%m-%Y)\/\"$DB\"\n    &#91; ! -d \"$DB_BKP_FLDR\" ] &amp;&amp; mkdir -p \"$DB_BKP_FLDR\"\n\n    for table in $(echo \"show tables;\"|mysql \"$DB\" -u $DB_USER $DB_PASS -N 2>> $BACKUP_LOG); do\n\n        if &#91; \"$table\" == event ]; then\n            mysqldump -u $DB_USER $DB_PASS --events \"$DB\" \"$table\" 2>> $BACKUP_LOG|gzip > \"$DB_BKP_FLDR\"\/\"$table\".sql.gz\n        elif &#91; \"$table\" == general_log ] || &#91; \"$table\" == slow_log ]; then\n            mysqldump -u $DB_USER $DB_PASS --skip-lock-tables \"$DB\" \"$table\" 2>> $BACKUP_LOG|gzip > \"$DB_BKP_FLDR\"\/\"$table\".sql.gz\n        else\n            mysqldump -u $DB_USER $DB_PASS \"$DB\" \"$table\" 2>> $BACKUP_LOG|gzip> \"$DB_BKP_FLDR\"\/\"$table\".sql.gz\n        fi\n\n        openssl enc -aes-256-cbc -salt -a -in \"$DB_BKP_FLDR\"\/\"$table\".sql.gz -out \"$DB_BKP_FLDR\"\/\"$table\".sql.gz.enc -k $DATA\n        s3cmd put \"$DB_BKP_FLDR\"\/\"$table\".sql.gz.enc s3:\/\/$S3BACKUP\/\"$DB\"\/\"$table\".sql.gz.enc\n        rm -f \"$DB_BKP_FLDR\"\/\"$table\".sql.gz \"$DB_BKP_FLDR\"\/\"$table\".sql.gz.enc\n\n    done\n\n    echo \"$DB\" >> $BACKUP_LOG\n\ndone\n\nIFS=$OIFS\n\nfind $BASE_BAK_FLDR\/-maxdepth 1 -mtime +5 -type d -exec rm -rf {} \\;\n\nCUR_VER=`s3cmd info s3:\/\/$S3BACKUP\/mysql\/user.sql.gz.enc | grep \"Last mod\" | awk -F\", \" '{print $2}'`\n\necho -e \"List of databases &amp; mysqldump errors(if any):\\n-----\\n`grep -v \"Using a password on the command line interface can be insecure\" $BACKUP_LOG`\\n-----\\nBackup location: s3:\/\/$S3BACKUP\/\\n\\nCurrent Version on s3: $CUR_VER\\n\\nPrevious Version on s3: $OLD_VER\\n\\nData: $DATA\" | mail -r $EMAIL -s \"SQL Backup Completed @ `date` : $TO_EMAIL<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Folder Structure<\/h1>\n\n\n\n<p>The generated backup structure looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>backup\/<br>\u2514\u2500\u2500 sqldailybackups\/<br>\u2514\u2500\u2500 07-08-2026\/<br>\u251c\u2500\u2500 database1\/<br>\u2502 \u251c\u2500\u2500 users.sql.gz.enc<br>\u2502 \u251c\u2500\u2500 orders.sql.gz.enc<br>\u2502 \u2514\u2500\u2500 products.sql.gz.enc<br>\u2502<br>\u2514\u2500\u2500 database2\/<br>\u251c\u2500\u2500 customer.sql.gz.enc<br>\u2514\u2500\u2500 invoice.sql.gz.enc<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Encryption Process<\/h1>\n\n\n\n<p>Every SQL dump is encrypted using OpenSSL.<\/p>\n\n\n\n<p>Example command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>openssl enc -aes-256-cbc \\<br>-salt \\<br>-a \\<br>-in users.sql.gz \\<br>-out users.sql.gz.enc \\<br>-k<\/code><\/pre>\n\n\n\n<p>This ensures that even if the backup file is accessed without authorization, the data remains protected.<\/p>\n\n\n\n<p>Store encryption keys securely. Do not commit them to version control or hardcode them in scripts.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Uploading to Amazon S3<\/h1>\n\n\n\n<p>Each encrypted backup is uploaded to Amazon S3.<\/p>\n\n\n\n<p>Example structure:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>s3:\/\/example-backup-bucket\/\n\ndatabase1\/\nusers.sql.gz.enc\norders.sql.gz.enc\n\ndatabase2\/\ncustomer.sql.gz.enc<\/code><\/pre>\n\n\n\n<p>If S3 Versioning is enabled, previous backup versions are retained automatically.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Automating Backups with Cron<\/h1>\n\n\n\n<p>Run the backup every night at 2:00 AM.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ 0 2 * * * \/opt\/scripts\/mysql-table-backup.sh<\/code><\/pre>\n\n\n\n<p>Always redirect output to a log file for troubleshooting.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Restoring a Backup<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1 \u2014 Download the Backup<\/h2>\n\n\n\n<p>Using AWS CLI:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ aws s3 cp s3:\/\/example-backup-bucket\/database1\/users.sql.gz.enc .<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2 \u2014 Decrypt the Backup<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>openssl enc -aes-256-cbc \\<br>-d \\<br>-a \\<br>-in users.sql.gz.enc \\<br>-out users.sql.gz \\<br>-k<\/code><\/pre>\n\n\n\n<p>The encryption key should be retrieved from your secure password manager or backup records.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3 \u2014 Extract the SQL File<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>$ gunzip users.sql.gz<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4 \u2014 Restore the Table<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>$ mysql database1 &lt; users.sql<\/code><\/pre>\n\n\n\n<p>The table is now restored.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Best Practices<\/h1>\n\n\n\n<p>For production environments, follow these recommendations:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Enable S3 Versioning.<\/li>\n\n\n\n<li>Use IAM Roles instead of access keys whenever possible.<\/li>\n\n\n\n<li>Enable Server-Side Encryption (SSE-S3 or SSE-KMS).<\/li>\n\n\n\n<li>Encrypt backups before uploading.<\/li>\n\n\n\n<li>Rotate encryption keys regularly.<\/li>\n\n\n\n<li>Store secrets securely using AWS Secrets Manager or Vault.<\/li>\n\n\n\n<li>Schedule automatic backups using cron.<\/li>\n\n\n\n<li>Test restoration procedures periodically.<\/li>\n\n\n\n<li>Monitor backup success and failures.<\/li>\n\n\n\n<li>Configure S3 Lifecycle Policies to archive or delete old backups.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Conclusion<\/h1>\n\n\n\n<p>Automating MySQL table-level backups with encryption and Amazon S3 provides a secure and efficient backup strategy for modern environments. By combining <code>mysqldump<\/code>, compression, AES-256 encryption, and cloud storage, you can build a backup solution that supports granular restores, protects sensitive data, and scales with your infrastructure. To maximize reliability, automate the process with cron, regularly test backup restoration, and follow cloud security best practices such as IAM roles, S3 Versioning, and lifecycle policies.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Backing up MySQL databases is one of the most critical responsibilities for database administrators and DevOps engineers. While full database backups are useful, there are many scenarios where backing up individual tables provides greater flexibility, faster recovery, and reduced storage consumption. In this guide, you&#8217;ll learn how to automate&hellip; <a href=\"https:\/\/pheonixsolutions.com\/blog\/script-to-take-tablewise-mysqldump-and-store-in-s3\/\" class=\"more-link read-more\" rel=\"bookmark\">Continue Reading <span class=\"screen-reader-text\">Automate MySQL Table-Level Backups to Amazon S3 with Encryption<\/span><i class=\"fa fa-arrow-right\"><\/i><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[819,386,290,223],"tags":[],"class_list":{"0":"post-697","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-aws","7":"category-database","8":"category-script","9":"category-shell-script","10":"h-entry","12":"h-as-article"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Pheonix Solutions - We Empower Your Business Growth<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/pheonixsolutions.com\/blog\/script-to-take-tablewise-mysqldump-and-store-in-s3\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Pheonix Solutions - We Empower Your Business Growth\" \/>\n<meta property=\"og:description\" content=\"Introduction Backing up MySQL databases is one of the most critical responsibilities for database administrators and DevOps engineers. While full database backups are useful, there are many scenarios where backing up individual tables provides greater flexibility, faster recovery, and reduced storage consumption. In this guide, you&#8217;ll learn how to automate&hellip; Continue Reading Automate MySQL Table-Level Backups to Amazon S3 with Encryption\" \/>\n<meta property=\"og:url\" content=\"https:\/\/pheonixsolutions.com\/blog\/script-to-take-tablewise-mysqldump-and-store-in-s3\/\" \/>\n<meta property=\"og:site_name\" content=\"PHEONIXSOLUTIONS\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/\" \/>\n<meta property=\"article:published_time\" content=\"2016-09-06T03:56:41+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-08-07T04:26:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/09\/PX2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"3837\" \/>\n\t<meta property=\"og:image:height\" content=\"2540\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pheonixsolution\" \/>\n<meta name=\"twitter:site\" content=\"@pheonixsolution\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/script-to-take-tablewise-mysqldump-and-store-in-s3\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/script-to-take-tablewise-mysqldump-and-store-in-s3\\\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/0ffa33d73c869faec2d50e79c24e3503\"},\"headline\":\"Automate MySQL Table-Level Backups to Amazon S3 with Encryption\",\"datePublished\":\"2016-09-06T03:56:41+00:00\",\"dateModified\":\"2026-08-07T04:26:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/script-to-take-tablewise-mysqldump-and-store-in-s3\\\/\"},\"wordCount\":659,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\"},\"articleSection\":[\"AWS\",\"Database\",\"Script\",\"Shell script\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/script-to-take-tablewise-mysqldump-and-store-in-s3\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/script-to-take-tablewise-mysqldump-and-store-in-s3\\\/\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/script-to-take-tablewise-mysqldump-and-store-in-s3\\\/\",\"name\":\"Pheonix Solutions - We Empower Your Business Growth\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#website\"},\"datePublished\":\"2016-09-06T03:56:41+00:00\",\"dateModified\":\"2026-08-07T04:26:58+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/script-to-take-tablewise-mysqldump-and-store-in-s3\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/script-to-take-tablewise-mysqldump-and-store-in-s3\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/script-to-take-tablewise-mysqldump-and-store-in-s3\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Automate MySQL Table-Level Backups to Amazon S3 with Encryption\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\",\"name\":\"Pheonix Solutions\",\"description\":\"We Empower Your Business Growth\",\"publisher\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\",\"name\":\"PheonixSolutions\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/logo.png\",\"contentUrl\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/logo.png\",\"width\":454,\"height\":300,\"caption\":\"PheonixSolutions\"},\"image\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/PheonixSolutions-209942982759387\\\/\",\"https:\\\/\\\/x.com\\\/pheonixsolution\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/0ffa33d73c869faec2d50e79c24e3503\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"http:\\\/\\\/pheonixsolutions.com\\\/blog\"],\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/author\\\/admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Pheonix Solutions - We Empower Your Business Growth","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/pheonixsolutions.com\/blog\/script-to-take-tablewise-mysqldump-and-store-in-s3\/","og_locale":"en_US","og_type":"article","og_title":"Pheonix Solutions - We Empower Your Business Growth","og_description":"Introduction Backing up MySQL databases is one of the most critical responsibilities for database administrators and DevOps engineers. While full database backups are useful, there are many scenarios where backing up individual tables provides greater flexibility, faster recovery, and reduced storage consumption. In this guide, you&#8217;ll learn how to automate&hellip; Continue Reading Automate MySQL Table-Level Backups to Amazon S3 with Encryption","og_url":"https:\/\/pheonixsolutions.com\/blog\/script-to-take-tablewise-mysqldump-and-store-in-s3\/","og_site_name":"PHEONIXSOLUTIONS","article_publisher":"https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/","article_published_time":"2016-09-06T03:56:41+00:00","article_modified_time":"2026-08-07T04:26:58+00:00","og_image":[{"width":3837,"height":2540,"url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/09\/PX2.png","type":"image\/png"}],"author":"admin","twitter_card":"summary_large_image","twitter_creator":"@pheonixsolution","twitter_site":"@pheonixsolution","twitter_misc":{"Written by":"admin","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/pheonixsolutions.com\/blog\/script-to-take-tablewise-mysqldump-and-store-in-s3\/#article","isPartOf":{"@id":"https:\/\/pheonixsolutions.com\/blog\/script-to-take-tablewise-mysqldump-and-store-in-s3\/"},"author":{"name":"admin","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/person\/0ffa33d73c869faec2d50e79c24e3503"},"headline":"Automate MySQL Table-Level Backups to Amazon S3 with Encryption","datePublished":"2016-09-06T03:56:41+00:00","dateModified":"2026-08-07T04:26:58+00:00","mainEntityOfPage":{"@id":"https:\/\/pheonixsolutions.com\/blog\/script-to-take-tablewise-mysqldump-and-store-in-s3\/"},"wordCount":659,"commentCount":0,"publisher":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#organization"},"articleSection":["AWS","Database","Script","Shell script"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/pheonixsolutions.com\/blog\/script-to-take-tablewise-mysqldump-and-store-in-s3\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/pheonixsolutions.com\/blog\/script-to-take-tablewise-mysqldump-and-store-in-s3\/","url":"https:\/\/pheonixsolutions.com\/blog\/script-to-take-tablewise-mysqldump-and-store-in-s3\/","name":"Pheonix Solutions - We Empower Your Business Growth","isPartOf":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#website"},"datePublished":"2016-09-06T03:56:41+00:00","dateModified":"2026-08-07T04:26:58+00:00","breadcrumb":{"@id":"https:\/\/pheonixsolutions.com\/blog\/script-to-take-tablewise-mysqldump-and-store-in-s3\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/pheonixsolutions.com\/blog\/script-to-take-tablewise-mysqldump-and-store-in-s3\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/pheonixsolutions.com\/blog\/script-to-take-tablewise-mysqldump-and-store-in-s3\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/pheonixsolutions.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Automate MySQL Table-Level Backups to Amazon S3 with Encryption"}]},{"@type":"WebSite","@id":"https:\/\/pheonixsolutions.com\/blog\/#website","url":"https:\/\/pheonixsolutions.com\/blog\/","name":"Pheonix Solutions","description":"We Empower Your Business Growth","publisher":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/pheonixsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/pheonixsolutions.com\/blog\/#organization","name":"PheonixSolutions","url":"https:\/\/pheonixsolutions.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/logo.png","contentUrl":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/logo.png","width":454,"height":300,"caption":"PheonixSolutions"},"image":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/","https:\/\/x.com\/pheonixsolution"]},{"@type":"Person","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/person\/0ffa33d73c869faec2d50e79c24e3503","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g","caption":"admin"},"sameAs":["http:\/\/pheonixsolutions.com\/blog"],"url":"https:\/\/pheonixsolutions.com\/blog\/author\/admin\/"}]}},"jetpack_shortlink":"https:\/\/wp.me\/p7F4uM-bf","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/697","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=697"}],"version-history":[{"count":4,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/697\/revisions"}],"predecessor-version":[{"id":10717,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/697\/revisions\/10717"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=697"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=697"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=697"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}