Okay I figured it out, so here comes the explanation to anyone else who might bump into this issue.
The problem is kind of privilege related, but merely because binary logging is enabled.
When binary logging is enabled, then it sometimes requires SUPER privilege to create a stored function. To bypass this while retaining the binary logging, there is a global variable named 'log_bin_trust_function_creators' which can be set to '1'. Default value is '0'
In sql it is done like this:
mysql> SET GLOBAL log_bin_trust_function_creators = 1;
Or you can supply an option when starting the MySQL server
Further information can be found here:
http://dev.mysql.com/doc/refman/5.1/en/stored-procedure-logging.htmlBest regards
Glenn