{"id":829,"date":"2022-04-01T10:08:29","date_gmt":"2022-04-01T03:08:29","guid":{"rendered":"https:\/\/www.bagi2info.com\/?p=829"},"modified":"2022-09-11T14:05:03","modified_gmt":"2022-09-11T07:05:03","slug":"script-simple-backup-database-mysql-dengan-command-prompt-dan-task-scheduler","status":"publish","type":"post","link":"https:\/\/www.bagi2info.com\/en\/script-simple-backup-database-mysql-dengan-command-prompt\/","title":{"rendered":"Script simple backup database Mysql  dengan command prompt"},"content":{"rendered":"\r\n\r\nConfused looking for automatic backup for mysql database?\r\n\r\nHere are easy and simple steps to perform scheduled automatic backups using the command prompt bat script and <strong>Task Scheduler<\/strong>\r\n\r\n1. Create a bat file with the name <strong>backupdb.bat<\/strong> with the following command\r\n\r\nmysqldump.exe -h localhost &#8211;user=root &#8211;password=admin &#8211;databases dbbackup &gt; C:\\backup\\dbbackup-%date:~-4.4%%date:~-10.2%%date:~ -7,2%.sql\r\n\r\n&#8220;C:\\Program Files\\7-Zip\\7z.exe&#8221; a -mx=9 C:\\backup\\dbbackup-%date:~-4.4%%date:~-10.2%%date:~- 7.2%.7z C:\\backup\\dbbackup-%date:~-4.4%%date:~-10.2%%date:~-7.2%.sql\r\n\r\ndel C:\\backup\\dbbackup-%date:~-4.4%%date:~-10.2%%date:~-7.2%.sql\r\n\r\nNote: the command above performs a database backup with the name db <strong>dbbackup<\/strong> using mysqldump in the c:\\backup folder the sample backup named <strong>dbbackup-20151125.sql<\/strong> takes from the system date, then compressed via 7zip, the last command deletes the sql file, leaving only the file compressed db backup\r\n\r\n2. Click<strong> Control Panel -&gt; Administrative Tools -&gt; Task Scheduler<\/strong>\r\n\r\n<img loading=\"lazy\" decoding=\"async\" width=\"290\" height=\"220\" class=\"wp-image-838\" src=\"https:\/\/www.bagi2info.com\/wp-content\/uploads\/2015\/11\/createtask-290x220.jpg\" alt=\"createtask\" \/>\r\n\r\nCheck Run whether the user is logged on or not so that the schedule job runs even if the user is logged in or not\r\n\r\n3. On the <strong>Actions<\/strong> tab, right click <strong>Create Task<\/strong>, input the name of schedule\r\n<img loading=\"lazy\" decoding=\"async\" width=\"290\" height=\"220\" class=\"wp-image-839\" src=\"https:\/\/www.bagi2info.com\/wp-content\/uploads\/2015\/11\/trigger-290x220.jpg\" alt=\"trigger\" \/>\r\n\r\n4. Select the Triggers tab, click New, determine whether your backup schedule is only for one process \/ per day \/ per week \/ per month.\r\n\r\nAlso specify when the date and time the schedule starts. Click OK.\r\n\r\n5. Select the Actions tab, fill in Program\/Script, select the backupdb.bat file that was created above. Click OK.\r\n<img loading=\"lazy\" decoding=\"async\" width=\"290\" height=\"220\" class=\"wp-image-837\" src=\"https:\/\/www.bagi2info.com\/wp-content\/uploads\/2015\/11\/actions-290x220.jpg\" alt=\"actions\" \/>\r\n6. Click Ok to save the backup job\r\n\r\nTo make sure the backup runs smoothly, try to test the bat file and on the job schedule, you can run the job schedule directly.\r\n\r\nRequired software:\r\n\r\n<strong>mysql<\/strong>\r\n\r\n<strong>7zip<\/strong>\r\n\r\n","protected":false},"excerpt":{"rendered":"<p>Confused looking for automatic backup for mysql database? Here are easy and simple steps to perform scheduled automatic backups using the command prompt bat script and Task Scheduler 1. Create a bat file with&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":838,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,14],"tags":[82,62],"class_list":["post-829","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-komputer","category-recommended","tag-mysql","tag-php"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.bagi2info.com\/en\/wp-json\/wp\/v2\/posts\/829","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bagi2info.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bagi2info.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bagi2info.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bagi2info.com\/en\/wp-json\/wp\/v2\/comments?post=829"}],"version-history":[{"count":0,"href":"https:\/\/www.bagi2info.com\/en\/wp-json\/wp\/v2\/posts\/829\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bagi2info.com\/en\/wp-json\/wp\/v2\/media\/838"}],"wp:attachment":[{"href":"https:\/\/www.bagi2info.com\/en\/wp-json\/wp\/v2\/media?parent=829"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bagi2info.com\/en\/wp-json\/wp\/v2\/categories?post=829"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bagi2info.com\/en\/wp-json\/wp\/v2\/tags?post=829"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}