How to execute system command in mysql stored procedure? Here is the code,

delimiter //
create procedure trig ()
begin
    declare cmd varchar(50);
    set cmd = "sh /home/yogaraj/Documents/Maastry/firefox.sh";
    system cmd;
end //

delimiter ;


But I can't execute system command. Can somebody help me?
This cannot be accomplished. Why ?

According to Can MySql stored proc call a system cmd? (from July 19, 2009 11:47AM)


  This question is asked several times a week. The answers are (i) not out of the box, for very good reasons, (ii) you could write and link into your server a UDF which calls the operating system, but that would create a glaring security issue for your app.


For example, I have written about using system before : Why would I use the MySQL &quot;system&quot; command?. In my post, I showed how easy it would be to step into the operating system with

mysql&gt; \! bash
[root@**** ~]# exit
exit
mysql&gt;


Imagine what one could do in the OS because of such a breach.

Usually, stored procedures are used to prevent SQL injection. If system was allowed within a stored procedure, that eliminates such security.

You will have to run the script as follows

mysql&gt; system /home/yogaraj/Documents/Maastry/firefox.sh


or

mysql&gt; \! /home/yogaraj/Documents/Maastry/firefox.sh


This is all you can really do