{"id":85,"date":"2009-09-16T03:29:15","date_gmt":"2009-09-16T03:29:15","guid":{"rendered":"http:\/\/samwebman.wordpress.com\/?p=85"},"modified":"2009-09-16T03:29:15","modified_gmt":"2009-09-16T03:29:15","slug":"windows-autobackup-mysql","status":"publish","type":"post","link":"https:\/\/www.intentrust.com\/?p=85","title":{"rendered":"Windows &#8211; Auto Backup Mysql Database"},"content":{"rendered":"<p>1. Save command lines below as .bat file<\/p>\n<p>2. Set Task schedule in windows.<\/p>\n<blockquote><p>@echo off<br \/>\nSET MysqlBinPath=MySQL\\bin\u7684\u8def\u5f91( eg. D:\\Mysql\\bin )<br \/>\nSET BackupPath=backup folder (eg. D:\\backup)<br \/>\nSET DBhost=machine ip ( eg. 211.58.1.2)<br \/>\nSET DBuser=database username (eg. root)<br \/>\nSET DBpass=database password (eg. 12345)<br \/>\nSET DBname=databaseName<br \/>\nSET Argument=&#8211;opt &#8211;compress &#8211;force &#8211;default-character-set=utf8<br \/>\nREM<br \/>\n\/* no need to fix below *\/<br \/>\nREM<br \/>\n\/* Get date\u3002<br \/>\nFOR \/F &#8220;tokens=1-4 delims=\/ &#8221; %%a IN (&#8220;%date%&#8221;) DO (<br \/>\nSET _MyDate=%%a-%%b-%%c %%d<br \/>\n)<br \/>\nREM \/* Export .sql filename with date\u3002 *\/<br \/>\necho database %DBname% during the backup\u2026\u2026<br \/>\n&#8220;%MysqlBinPath%\\mysqldump&#8221; &#8211;host=%DBhost% &#8211;user=%DBuser% &#8211;password=%DBpass% %Argument% %DBname%\u00a0 &gt;; &#8220;%BackupPath%\\%_MyDate%.sql&#8221;<br \/>\nREM<br \/>\n\/* Debug Messages *\/<br \/>\nIF<br \/>\nNOT %ERRORLEVEL% == 0 (<br \/>\ndel &#8220;%BackupPath%\\%_MyDate%.sql<br \/>\necho.<br \/>\necho Something wrong! Plz refer to the messages above\uff01<br \/>\npause<br \/>\n)<\/p><\/blockquote>\n<p>Reference from: <a href=\"http:\/\/www.ge.net.tw\/?q=node\/521\" target=\"_blank\" rel=\"noopener\">http:\/\/www.ge.net.tw\/?q=node\/521<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. Save command lines below as .bat file 2. Set Task sc &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.intentrust.com\/?p=85\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008Windows &#8211; Auto Backup Mysql Database\u3009<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[13],"tags":[36,37],"_links":{"self":[{"href":"https:\/\/www.intentrust.com\/index.php?rest_route=\/wp\/v2\/posts\/85"}],"collection":[{"href":"https:\/\/www.intentrust.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.intentrust.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.intentrust.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.intentrust.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=85"}],"version-history":[{"count":0,"href":"https:\/\/www.intentrust.com\/index.php?rest_route=\/wp\/v2\/posts\/85\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.intentrust.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=85"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.intentrust.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=85"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.intentrust.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=85"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}