CREATE DATABASE db1 CHARACTER SET utf8; USE db1; CREATE FUNCTION f4 () RETURNS ENUM( 'w' ) CHARACTER SET ucs2 RETURN 0; SELECT DTD_IDENTIFIER FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'f4'; --replace_column 1 # BACKUP DATABASE db1 to 'db1.bak'; --replace_column 1 # RESTORE FROM 'db1.bak' overwrite; SELECT DTD_IDENTIFIER FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'f4'; --echo # Recreate using same presteps as mysql backup. But with original CREATE. DROP DATABASE db1; CREATE DATABASE db1 CHARACTER SET utf8; USE db1; SET character_set_client = latin1; SET collation_connection = latin1_swedish_ci; SET collation_database = utf8_general_ci; SET sql_mode = ''; CREATE FUNCTION f4 () RETURNS ENUM( 'w' ) CHARACTER SET ucs2 RETURN 0; SHOW CREATE FUNCTION f4; SELECT DTD_IDENTIFIER FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'f4'; --echo # Recreate using same presteps as mysql backup. But with CREATE --echo # from backup image as reported by mysqlbackup. DROP DATABASE db1; CREATE DATABASE db1 CHARACTER SET utf8; USE db1; SET character_set_client = latin1; SET collation_connection = latin1_swedish_ci; SET collation_database = utf8_general_ci; SET sql_mode = ''; CREATE DEFINER=`root`@`localhost` FUNCTION `f4`() RETURNS enum('\0w') CHARSET ucs2 RETURN 0; SHOW CREATE FUNCTION f4; SELECT DTD_IDENTIFIER FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'f4'; --echo # Recreate using same presteps as mysql backup. But with CREATE --echo # from backup image as reported by mysqlbackup only without the --echo # extra \0. DROP DATABASE db1; CREATE DATABASE db1 CHARACTER SET utf8; USE db1; SET character_set_client = latin1; SET collation_connection = latin1_swedish_ci; SET collation_database = utf8_general_ci; SET sql_mode = ''; CREATE DEFINER=`root`@`localhost` FUNCTION `f4`() RETURNS enum('w') CHARSET ucs2 RETURN 0; SHOW CREATE FUNCTION f4; SELECT DTD_IDENTIFIER FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'f4'; DROP DATABASE db1;