2015-10-15 55 views
0

備份表到本地磁盤我想備份一個數據庫表到我的本地路徑用低於mysql命令.sql文件,如何使用MySQL事件

create event backupIn_home_Directory_sqlfile on every 1 day 
starts '2015-10-14 16:10:00' 
do 
select * into outfile 'C:\Users\username\Desktop/backupcehcking.sql' from testingDB.table_test; 

但我收到以下錯誤:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax to use near 'every 
1 day starts '2015-10-15 13:10:00' do select * into outfile 'C:\Users\user' at 
line 1 

我在做什麼錯?

按答案,我改變了命令,

mysql> alter event backupIn_home_Directory_sqlfile do select * into outfile 'C:\ 
Users\RAGHU_ZANCT\Documents\DBbackup_Checking\backupcehcking.sql' from testing.m 
anitest; 
Query OK, 0 rows affected (0.00 sec) 

mysql> alter event backupIn_home_Directory_sqlfile on schedule every 1 day start 
s '2015-10-15 15:28:00'; 

Eventhough我不覺得在那個特定文件夾backupcehcking.sql文件。爲什麼?

回答

0

我想你忘記了SCHEDULE

使用本:

create event backupIn_home_Directory_sqlfile on schedule every 1 day 

語法示例:

CREATE EVENT event_name 
    ON SCHEDULE 
    EVERY 1 DAY 
    COMMENT 'Optinal comment goes here' 
    DO 
    YOUR QUERY; 
+0

雅你是正確的我錯過了日程。現在創建了事件,但我沒有看到該特定路徑中的backupcehcking.sql文件。 – MMMMS

+0

我所有的斜線應該是相同的'C:\用戶\用戶名\桌面\ backupcehcking.sql' – madforstrength

+0

我做了改變事件到C:\用戶\用戶名\桌面\ backupcehcking.sql即使我沒有找到backupcehcking.sql文件那裏。 :(我在哪裏做錯? – MMMMS