Syed Muhammad Kamruzzaman Syed Muhammad Kamruzzaman - 4 years ago 197
Linux Question

Execute Shell Commands from mysql Store Procedure

Is it possible to move file from one folder to another from mysql(linux) stored procedure??

if possible, how?

Answer Source

Can you try this??

DELIMITER @@

CREATE TRIGGER Test_Trigger 
AFTER INSERT ON MyTable 
FOR EACH ROW 
BEGIN
 DECLARE cmd CHAR(255);
 DECLARE result int(10);
 SET cmd=('mv path/to/file new/path/file');
 SET result = sys_exec(cmd);
END;
@@
DELIMITER ;

I found that in this site http://crazytechthoughts.blogspot.com/2011/12/call-external-program-from-mysql.html

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download