{"id":1334,"date":"2026-06-13T02:58:04","date_gmt":"2026-06-13T02:58:04","guid":{"rendered":"https:\/\/johnnycarlos.com\/?p=1334"},"modified":"2026-06-13T02:58:04","modified_gmt":"2026-06-13T02:58:04","slug":"some-mistakes-i-made-trying-to-automate-backups-of-my-wordpress-blog","status":"publish","type":"post","link":"https:\/\/johnnycarlos.com\/index.php\/2026\/06\/13\/some-mistakes-i-made-trying-to-automate-backups-of-my-wordpress-blog\/","title":{"rendered":"Some Mistakes I Made Trying to Automate Backups of My WordPress Blog"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I&#8217;m giving myself some side projects to keep my skills sharp.  Well, I&#8217;m going to apply for a supervisor position soon and I&#8217;m worried about losing my technical skills so I&#8217;m giving myself fun tech projects at home.  One I&#8217;ve been thinking about lately is backing up my blog.  I wanted a cronjob script to run on my home machine that downloads the content and a database dump weekly on to my home machine.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There were a couple of gotchas I want to document to help me remember them.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The first was my dump command gave me an error I never seen:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>mysqldump: Error: &#8216;Access denied; you need (at least one of) the PROCESS privilege(s) for this operation&#8217; when trying to dump tablespaces<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Newer versions of MySQL require the <code>PROCESS<\/code> privilege just to dump tablespace metadata, which your WordPress DB user (correctly) doesn&#8217;t have. The good news: I don&#8217;t need tablespace info at all for a WordPress backup.  There&#8217;s no need to grant that privilege if I just don&#8217;t need it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Solution:  Add the <code>--no-tablespaces<\/code> flag to the mysqldump line in the script:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh \"$VPS\" \"mysqldump --single-transaction --no-tablespaces wordpress | gzip\" \\\n    > \"$DEST\/$STAMP\/db-$STAMP.sql.gz\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The next gotcha mistake I made is because I never really understood ssh-agents.  And I really  need to look into how that works.  It&#8217;s still a mystery to me.  But from what I understand now, my Ubuntu desktop is using it and crontab does not have access to it.  So from crontabs perspective, I had no ssh key.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The solution was to create a dedicated passphrase-less key just for this job, and authorize it on the VPS:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh-keygen -t ed25519 -f ~\/.ssh\/blog-backup -N \"\"\nssh-copy-id -i ~\/.ssh\/blog-backup.pub username@ip-address<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then my script needed to tell the remote commands to use the key:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh -i \"$HOME\/.ssh\/blog-backup\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m giving myself some side projects to keep my skills sharp. Well, I&#8217;m going to apply for a supervisor position soon and I&#8217;m worried about losing my technical skills so I&#8217;m giving myself fun tech projects at home. One I&#8217;ve been thinking about lately is backing up my blog. I wanted a cronjob script to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"cybocfi_hide_featured_image":"","footnotes":""},"categories":[28,36,29],"tags":[],"class_list":["post-1334","post","type-post","status-publish","format-standard","hentry","category-blog","category-linux","category-today-i-learned"],"_links":{"self":[{"href":"https:\/\/johnnycarlos.com\/index.php\/wp-json\/wp\/v2\/posts\/1334","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/johnnycarlos.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/johnnycarlos.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/johnnycarlos.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/johnnycarlos.com\/index.php\/wp-json\/wp\/v2\/comments?post=1334"}],"version-history":[{"count":1,"href":"https:\/\/johnnycarlos.com\/index.php\/wp-json\/wp\/v2\/posts\/1334\/revisions"}],"predecessor-version":[{"id":1335,"href":"https:\/\/johnnycarlos.com\/index.php\/wp-json\/wp\/v2\/posts\/1334\/revisions\/1335"}],"wp:attachment":[{"href":"https:\/\/johnnycarlos.com\/index.php\/wp-json\/wp\/v2\/media?parent=1334"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/johnnycarlos.com\/index.php\/wp-json\/wp\/v2\/categories?post=1334"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/johnnycarlos.com\/index.php\/wp-json\/wp\/v2\/tags?post=1334"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}