This is on my Gentoo box.
Recently, a MySQL upgrade seems to have broken my UDFs, specifically those in lib_mysqludf_preg. I first noticed errors like:
FUNCTION tablename.PREG_RLIKE does not exist
I figured, OK, I must have to reinstall them. I try the config command for lib_mysqludf_preg and get this:
ERROR 1125 (HY000) at line 17: Function 'lib_mysqludf_preg_info' already exists
I figured, OK, maybe I have to uninstall them then reinstall them, but that didn't work either. Here is a SQL script that illustrates the problem:
USE mysql;
DROP FUNCTION lib_mysqludf_preg_info;
CREATE FUNCTION lib_mysqludf_preg_info RETURNS STRING SONAME 'lib_mysqludf_preg.so';
and the output:
FUNCTION mysql.lib_mysqludf_preg_info does not exist
Function 'lib_mysqludf_preg_info' already exists
I made sure to update the tables but it didn't matter.
I've tried rolling back the MySQL version but that didn't help.
I even tried using the MySQL version that's still in beta stage in the Portage tree but I get the same result with any version of MySQL I try to use now, even if I unmerge the existing one first.
And of course I've tried unmerging lib_mysqludf_preg and remerging it for each new MySQL version, as well as restarting mysqld (or not) between every step. Same result every time.
Even running these queries as root gives the same errors so I don't think it's a permissions issue.
How can I fix this, and how can I avoid making the same mistake in the future?