Common SQL Errors

MySQL Error 1123: ER_CANT_INITIALIZE_UDF - How to Fix and Prevent

Galaxy Team
August 5, 2025

Error 1123 (ER_CANT_INITIALIZE_UDF) appears when MySQL fails to load or initialize a user-defined function (UDF) before execution.

Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

What is MySQL error 1123?

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.

Error Highlights

Typical Error Message

Can't initialize function '%s'; %s

Error Type

Execution Error

Language

MySQL

Symbol

ER_CANT_INITIALIZE_UDF

Error Code

1123

SQL State

Explanation

Table of Contents

What is MySQL error 1123 (ER_CANT_INITIALIZE_UDF)?

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.

When does the error appear?

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.

Why is it critical to fix?

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.

.

Common Causes

Missing or wrong shared object (.so/.dll)

The path registered in mysql.func may not contain the library, or the file was deleted during deployment.

ABI or signature mismatch

The UDF was compiled against a different MySQL major version, causing symbol or structure size conflicts during initialization.

Incorrect file permissions or SELinux/AppArmor blocks

The mysqld process lacks read or execute rights on the shared object, or security profiles deny dlopen.

Faulty init method inside the UDF

The init() function in the source code returns non-zero because of invalid arguments, memory allocation failure, or missing external dependencies.

Binary path hard-coding

Deployment tools moving libraries to new directories without updating CREATE FUNCTION statements leave stale paths in mysql.func.

.

Related Errors

FAQs

How do I check if my UDF is registered?

Query mysql.func to list all user-defined functions and their library paths.

Can I load UDFs from any directory?

By default, mysqld restricts loading to plugin_dir. Place libraries there or update the plugin_dir variable.

Does FLUSH FUNCTIONS require a restart?

No. FLUSH FUNCTIONS reloads all UDF libraries without restarting the server, making it useful after recompiling.

How does Galaxy help avoid UDF errors?

Galaxy’s AI copilot flags missing UDFs during query authoring, while its versioned SQL collections ensure CREATE FUNCTION scripts remain synchronized across environments.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo