俊星的BLOG

          Mysql備份

          1、編寫相關的備份腳本backup.bat:
          @echo off
          mysqldump -uroot -pXXX test>D:\db_backup\test%date:~0,10%.sql
          其中“%date:~0,10%”表示取出日期后截取前10個字符,因為在目標機器運行%date%得到的是“2010-10-13 星期三”,不符合要求。

          2、執行過程中,報如下錯誤:
          mysqldump:   Got   error:   1045:   Access   denied   for   user:   'root@localhost '   (Using   password:   NO)   when   trying   to   connect
          原因是權限不夠,處理措施如下:

          C:\Documents and Settings\Administrator.SPARK001>mysql -uroot -pXXX
          Welcome to the MySQL monitor.  Commands end with ; or \g.
          Your MySQL connection id is 1450
          Server version: 5.0.67-community MySQL Community Edition (GPL)

          Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
          mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY 'root' WITH GRANT OPTION;
          Query OK, 0 rows affected (0.06 sec)

          mysql> flush privileges;
          Query OK, 0 rows affected (0.00 sec)


          3、運行bat文件后,即生成了“test2010-10-13.sql”類的文件,最后通過設置WINDOWS系統工具中的任務計劃功能,即可實現自動備份。

          posted on 2010-10-13 18:15 俊星 閱讀(158) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 宜兰市| 成都市| 龙游县| 毕节市| 南皮县| 丰镇市| 永兴县| 略阳县| 武川县| 微山县| 临洮县| 塔河县| 祁门县| 沈丘县| 利川市| 长宁县| 江川县| 吐鲁番市| 宣化县| 永昌县| 岗巴县| 冷水江市| 河源市| 宁乡县| 高淳县| 临西县| 剑阁县| 鄂托克前旗| 诸暨市| 大关县| 宁阳县| 房产| 平阴县| 密云县| 和平县| 区。| 德清县| 临桂县| 渝中区| 龙井市| 云梦县|