Error 1123 (ER_CANT_INITIALIZE_UDF) appears when MySQL fails to load or initialize a user-defined function (UDF) before execution.
MySQL Error 1123: ER_CANT_INITIALIZE_UDF occurs when the server cannot load or initialize a user-defined function due to missing libraries, incorrect permissions, or signature mismatches. Reinstall the shared object, grant EXECUTE on the function, and ensure it is compiled for the server version to resolve.
Can't initialize function '%s'; %s
Error 1123 fires when MySQL calls a user-defined function but cannot finish its initialization routine. The accompanying message shows the UDF name and a system-level reason such as library not found or symbol mismatch.
Initialization happens at the first invocation after a server start or FLUSH FUNCTIONS.
If any step in dlopen, dlsym, or the UDF's own init method fails, the server aborts the call and throws this execution error.
The error commonly surfaces right after a CREATE FUNCTION statement or at runtime when applications depend on UDFs for string, math, or geospatial processing.
It is version-agnostic but more frequent on OS or MySQL upgrades that invalidate compiled binaries.
Unresolved UDFs break application logic, trigger cascading failures in stored routines, and may leave connections hanging. Rapid remediation restores deterministic query behavior and avoids application downtime.
.
The path registered in mysql.func may not contain the library, or the file was deleted during deployment.
The UDF was compiled against a different MySQL major version, causing symbol or structure size conflicts during initialization.
The mysqld process lacks read or execute rights on the shared object, or security profiles deny dlopen.
The init() function in the source code returns non-zero because of invalid arguments, memory allocation failure, or missing external dependencies.
Deployment tools moving libraries to new directories without updating CREATE FUNCTION statements leave stale paths in mysql.func.
.
Query mysql.func to list all user-defined functions and their library paths.
By default, mysqld restricts loading to plugin_dir. Place libraries there or update the plugin_dir variable.
No. FLUSH FUNCTIONS reloads all UDF libraries without restarting the server, making it useful after recompiling.
Galaxy’s AI copilot flags missing UDFs during query authoring, while its versioned SQL collections ensure CREATE FUNCTION scripts remain synchronized across environments.