MySQL takes several measures to prevent misuse of user-defined functions.
UDF object files cannot be placed in arbitrary directories.
They must be located in the server's plugin directory. This
directory is given by the value of the
plugin_dir system variable.
This is a change in MySQL 5.1. For earlier versions of MySQL, the shared object can be located in any directory that is searched by your system's dynamic linker.
CREATE FUNCTION or
DROP FUNCTION, you must have
DELETE privilege, respectively,
mysql database. This is necessary
because those statements add and delete rows from the
UDFs should have at least one symbol defined in addition to
xxx symbol that corresponds to the main
xxx() function. These auxiliary symbols
correspond to the
mysqld also supports an
that controls whether UDFs that have only an
xxx symbol can be loaded. By default, the
option is off, to prevent attempts at loading functions from
shared object files other than those containing legitimate
UDFs. If you have older UDFs that contain only the
xxx symbol and that cannot be recompiled to
include an auxiliary symbol, it may be necessary to specify
option. Otherwise, you should avoid enabling this capability.