Error 1122 occurs when MySQL cannot locate or load a requested user-defined function (UDF) library.
MySQL Error 1122: ER_CANT_FIND_UDF means the server cannot load a referenced user-defined function shared library. Verify the .so/.dll file is in the plugin directory, grant FILE privilege, and run INSTALL FUNCTION with the correct path to resolve the issue.
Can't load function '%s'
Error 1122 appears with the message "Can't load function '%s'" when MySQL fails to locate or link the shared library that implements a user-defined function (UDF). The server aborts the call and returns SQLSTATE HY000.
The problem surfaces immediately after executing CREATE FUNCTION, INSTALL COMPONENT, or when invoking an existing UDF.
It affects query execution, stored routines, and any application logic that depends on the missing function.
MySQL throws ER_CANT_FIND_UDF when the shared object file (.so on Linux, .dll on Windows) is missing, unreadable, compiled for the wrong CPU architecture, or placed outside the plugin directory defined by plugin_dir.
Incorrect file ownership or restrictive filesystem permissions can block the mysqld process from reading the library, triggering the error even if the file exists.
A mismatched MySQL version or ABI difference causes symbol lookup failures at load time, producing the same error code.
Confirm the UDF library is present in the server's plugin directory (SHOW VARIABLES LIKE 'plugin_dir').
Copy or move the file there and restart MySQL if necessary.
Ensure the mysqld user has read and execute rights on the file and its parent directories (chmod 755 /path/libmyudf.so && chown mysql:mysql /path/libmyudf.so).
Re-install the function with the absolute path if plugin_dir is not used: CREATE FUNCTION myfunc RETURNS INTEGER SONAME 'libmyudf.so';
Recompile the UDF with the same compiler and architecture flags used by your MySQL distribution to resolve symbol or ABI mismatches.
Upgrading MySQL without rebuilding custom UDFs often breaks binary compatibility.
Rebuild and redeploy the library to fix the error.
Copying production dumps to a staging server that lacks the UDF library triggers 1122 on import. Install or stub out the UDF before restoring the dump.
Store all approved UDF libraries in version control and automate deployment so every environment has matching binaries.
Use Galaxy's endorsed-query workflow to eliminate ad hoc CREATE FUNCTION statements.
Central review ensures libraries are compiled, signed, and stored in the correct path.
ER_CANT_OPEN_LIBRARY (1126) surfaces when the plugin framework cannot open a shared library at all, usually due to a bad path. Fix by adjusting INSTALL PLUGIN paths or plugin_dir.
ER_CANT_FIND_DL_ENTRY (1124) occurs if MySQL loads the library but cannot find the expected symbol. Recompile the function or correct the symbol name in CREATE FUNCTION.
.
The .so or .dll defining the UDF is not present in plugin_dir or the specified absolute path.
mysqld lacks read or execute permission on the library file or its directories.
The library was compiled against headers that differ from the running server, causing symbol resolution failure.
Attempting to load a 32-bit library into a 64-bit server (or vice versa) triggers the error.
Security modules block mysqld from accessing files outside approved directories, preventing the UDF from loading.
.
No. After placing the library in plugin_dir, a new CREATE FUNCTION or INSTALL COMPONENT command loads it immediately without a restart.
Yes, but you must provide the absolute path in CREATE FUNCTION. Keeping all UDFs inside plugin_dir simplifies deployment.
Execute DROP FUNCTION func_name;
then delete the shared library from the filesystem.
Galaxy lets teams version and review CREATE FUNCTION statements in endorsed collections, reducing broken UDF deployments.