Another dirty way to do so by avoiding the use of a PROCEDURE is to use a prepared statement : SET @inst_plug=IF((SELECT 1 FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME='unix_socket' AND PLUGIN_STATUS='ACTIVE' AND PLUGIN_TYPE='AUTHENTICATION' AND PLUGIN_LIBRARY LIKE CONCAT('auth_socket','%'))=1, 'SELECT 1 LIMIT 0', "INSTALL PLUGIN unix_socket SONAME 'auth_socket'"); PREPARE inst_plug FROM @inst_plug; EXECUTE inst_plug; It will install the plugin if not present and wont return anything (and no error) on the other case. As for the idea to do it the simplest way (simply execute the INSTALL PLUGIN statement) and skip the exit on error as done for the "$password_column_fix_query" execution just few lines before ("set +e"). That way, the INSTALL PLUGIN statement could be added directly to the "$password_column_fix_query" execution rather than re-starting once more mysqld without even checking its exit status. ps: as a side note, the content of the replace_query variable set on line 160 should be directly put on the line 192 as its only called once. Le 24/02/2015 11:49, Daniel Black a écrit :
----- Original Message -----
Thanks for your help!
How should this then be re-written correctly? Thinking strip away the procedures and work directly with a query of the information schema.
perhaps even just call: set sql_log_bin=0; install plugin "unix_socket"
and ignore the error if it exists..
SET sql_log_bin=0; USE mysql; DELIMITER //; CREATE PROCEDURE debian_plugin_install(IN plugin_name CHAR(50), IN soname CHAR(50)) BEGIN DECLARE CONTINUE HANDLER FOR NOT FOUND EXECUTE inst_plug; set @plugin_name=plugin_name; set @soname=soname ;set @install_plugin=CONCAT(\"INSTALL PLUGIN \",@plugin_name,\" SONAME '\", @soname, \"'\");PREPARE inst_plug FROM @install_plugin ; select PLUGIN_NAME INTO @a from information_schema.plugins where PLUGIN_NAME=@plugin_name AND PLUGIN_STATUS='ACTIVE' AND PLUGIN_TYPE='AUTHENTICATION' AND PLUGIN_LIBRARY LIKE concat(@soname,'%' ); DEALLOCATE PREPARE inst_plug; END// CALL debian_plugin_install('unix_socket', 'auth_socket') // DROP PROCEDURE debian_plugin_install//
https://github.com/ottok/mariadb-10.0/blob/master/debian/mariadb-server-10.0...
Pull requests appreciated :)