This is caused if you have the following set in your MySQL configuration file:
When you create a stored function, you must declare either that it is deterministic or that it does not modify data. Otherwise, it may be unsafe for data recovery or replication.
By default, for a CREATE FUNCTION statement to be accepted, at least one of DETERMINISTIC, NO SQL, or READS SQL DATA must be specified explicitly; otherwise an error occurs.
The error arises if the binary logging option, which is required for replication, is turned on for the MySQL server.