2010
MySQLERRORNotableUDFHIGH confidence
Cannot open shared library for UDF
Production Risk
Low — UDF creation is rejected.
What this means
MySQL could not open the shared library (.so / .dll) specified in a CREATE FUNCTION (UDF) statement. The file may not exist in plugin_dir, may have wrong permissions, or may have unresolved symbol dependencies.
Why it happens
- 1Library file not present in plugin_dir.
- 2File permissions prevent the MySQL process from reading the library.
- 3Missing dependencies (shared library depends on another .so not installed).
- 4Wrong architecture (e.g. 32-bit library on a 64-bit server).
How to reproduce
trigger — this will error
trigger — this will error
CREATE FUNCTION my_func RETURNS STRING SONAME 'nonexistent.so';
expected output
ERROR 2010 (HY000): Can't open shared library 'nonexistent.so' (errno: 22 No such file or directory).
Fix 1
Verify the library exists in plugin_dir with correct permissions
Verify the library exists in plugin_dir with correct permissions
SHOW VARIABLES LIKE 'plugin_dir'; -- Then: ls -la /path/to/plugin_dir/myfunc.so
Why this works
The library must be readable by the MySQL process user.
Fix 2
Install missing library dependencies
Install missing library dependencies
-- On Linux: ldd /path/to/plugin_dir/myfunc.so
Why this works
Unresolved dependencies prevent dlopen() from loading the library.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 2010 ER_CANT_OPEN_LIBRARY
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev