{"id":243,"date":"2012-07-24T11:58:05","date_gmt":"2012-07-24T11:58:05","guid":{"rendered":"http:\/\/scunster.co.uk\/?p=243"},"modified":"2012-11-25T20:14:01","modified_gmt":"2012-11-25T20:14:01","slug":"auto-back-up-mysql-database","status":"publish","type":"post","link":"https:\/\/scunster.co.uk\/?p=243","title":{"rendered":"Auto back up MYSQL Database using cron"},"content":{"rendered":"<p>phpMyAdmin is the easiest tool to backup databases but if you want to automate the process simply add this line to cron<!--more--><\/p>\n<p>sudo crontab -e<\/p>\n<p>mysqldump -u<span style=\"color: #ff0000;\">USER<\/span> -p<span style=\"color: #ff0000;\">PASS<\/span> <span style=\"color: #ff0000;\">database_name<\/span> &gt; \/var\/www\/<span style=\"color: #ff0000;\">database<\/span>.sql<\/p>\n<pre>change USER, PASS and database_name, you can of course change the location of where to save the file to as well\r\n\r\nIf adding to cron don't forget the time settings!\r\n\r\nexample to back up specific database evry day at 2am\r\n\r\n0 2 * * * mysqldump -uUSER -pPASS database_name &gt; \/var\/www\/database.sql<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>phpMyAdmin is the easiest tool to backup databases but if you want to automate the process simply add this line to cron<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-243","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/243","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=243"}],"version-history":[{"count":3,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/243\/revisions"}],"predecessor-version":[{"id":454,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/243\/revisions\/454"}],"wp:attachment":[{"href":"https:\/\/scunster.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}