{"id":92,"date":"2021-11-02T03:34:13","date_gmt":"2021-11-02T03:34:13","guid":{"rendered":"https:\/\/vvcares.com\/2\/?p=92"},"modified":"2023-03-26T14:06:13","modified_gmt":"2023-03-26T08:36:13","slug":"backup-all-mysql-databases-compress-single-script-solved","status":"publish","type":"post","link":"https:\/\/vvcares.com\/blog\/backup-all-mysql-databases-compress-single-script-solved\/","title":{"rendered":"BACKUP ALL MYSQL DATABASES &#8211; COMPRESS SINGLE SCRIPT &#8211; EMAIL LOG"},"content":{"rendered":"<p><em>Please read the script fully before you execute. Actually there is no harm there but you have to know what you doing..<\/em><\/p>\n<p>Just download the script and run via SSH-CLI terminal<\/p>\n<ul>\n<li>backup each mysql db into a different file, rather than one big file<\/li>\n<li>as with &#8211;all-databases. This will make restores easier.<\/li>\n<li>To backup a single database simply add the db name as a parameter (or multiple dbs)<\/li>\n<li>\n<pre>mkdir -p \/vv_files\/backups<\/pre>\n<\/li>\n<li>\n<pre>useradd --home-dir \/var\/backups\/mysql --gid backup --no-create-home mysql-backup<\/pre>\n<\/li>\n<li>Remember to make the script executable, and unreadable by others<\/li>\n<li>\n<pre>chown -R mysql-backup:backup \/var\/backups\/mysql<\/pre>\n<\/li>\n<li>\n<pre>chmod u=rwx,g=rx,o= \/var\/backups\/mysql\/dump.sh<\/pre>\n<\/li>\n<li>crontab entry &#8211; backup every 6 hours<\/li>\n<li>sudo crontab -e [ set your desired timing. 6 hrs is safer for sysadmins]<\/li>\n<\/ul>\n<p><em>&#8211;\u00a0<a href=\"https:\/\/github.com\/vvcares\/hestia\/blob\/master\/bkp_dbs.sh\" target=\"_blank\" rel=\"noopener\">Download the script file from our\u00a0 <strong>GITHUB VVCARES<\/strong><\/a><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Please read the script fully before you execute. Actually there is no harm there but you have to know what you doing.. Just download the script and run via SSH-CLI terminal backup each mysql db into a different file, rather than one big file as with &#8211;all-databases. This will make restores easier. To backup a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,1],"tags":[],"class_list":["post-92","post","type-post","status-publish","format-standard","hentry","category-linux-ubuntu","category-servers"],"_links":{"self":[{"href":"https:\/\/vvcares.com\/blog\/wp-json\/wp\/v2\/posts\/92","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vvcares.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vvcares.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vvcares.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vvcares.com\/blog\/wp-json\/wp\/v2\/comments?post=92"}],"version-history":[{"count":0,"href":"https:\/\/vvcares.com\/blog\/wp-json\/wp\/v2\/posts\/92\/revisions"}],"wp:attachment":[{"href":"https:\/\/vvcares.com\/blog\/wp-json\/wp\/v2\/media?parent=92"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vvcares.com\/blog\/wp-json\/wp\/v2\/categories?post=92"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vvcares.com\/blog\/wp-json\/wp\/v2\/tags?post=92"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}