说明:运行完成,会生成一个删除原有触发器,生成新的触发器的sql,方便选择性的运行

delimiter ////

        set @definner = 'root@127.0.0.1';

        SET SESSION group_concat_max_len = 100000000000;

        select group_concat(
                                        CONCAT('use ',dbname,char(10),'#######No.',(@rowNum:=@rowNum+1),',old definner=',obj_defer,',new definner=',@definner,'#######',char(10),'delimiter ****',char(10),
                                                                        'DROP TRIGGER if exists `',trig_name,'`;',char(10),
                                                                        'CREATE DEFINER=',@definner ,' TRIGGER `',trig_name,'` ',timing,' ',evnt,' ON `',tb_name,'`',char(10),
                                                                        'FOR EACH ROW',char(10),
                                                                        sql_body,';',char(10),
                                                                        '****',char(10),
                                                                        'delimiter ;',char(10),char(10)
                                                        )
                        separator '')
                                                           as s from (
        select TRIGGER_SCHEMA as dbname,TRIGGER_NAME as trig_name,EVENT_MANIPULATION as evnt,EVENT_OBJECT_TABLE as tb_name,ACTION_STATEMENT as sql_body,ACTION_TIMING as timing,DEFINER as obj_defer from `information_schema`.`TRIGGERS`
        ,
        (Select (@rowNum :=0) ) b
        ) x
           where obj_defer !=@definner and obj_defer!=replace(@definner,'`','')
        
        into dumpfile '/user/tmp/aaa.sql';
        
////

第一次接触maxscale,打算用来干点坏事。
maxscale版本2.3.4 ,发现root连接时,报错

Access denied for user 'root'@'::ffff:127.0.0.1' (using password: YES)

同事石头歌网上找到

[Read-Write-Listener]
type=listener
service=Read-Write-Service
protocol=MariaDBClient
port=3306
#增加以下配置
address=0.0.0.0

配置好后,发现继续报错

Access denied for user 'root'@'127.0.0.1' (using password: YES)

查看官方手册,root用户默认是禁止连接maxscale的。
于是[Read-Write-Service]增加

enable_root_user=1

问题解决,同时发现之前增加的address=0.0.0.0内容可以不用增加