Snippets Collections
CREATE DEFINER=`rdsadmin`@`localhost` PROCEDURE `rds_set_configuration`(IN name VARCHAR(30), IN value INT)
    READS SQL DATA
    DETERMINISTIC
BEGIN
   DECLARE sql_logging BOOLEAN;

   IF name = 'binlog retention hours' AND value NOT BETWEEN 1 AND 168 THEN
       SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'For binlog retention hours the value must be between 1 and 168 inclusive or be NULL';
   END IF;

   SELECT @@sql_log_bin INTO sql_logging;
   SET @@sql_log_bin = OFF;   
   UPDATE mysql.rds_configuration
   SET mysql.rds_configuration.value = value
   WHERE BINARY mysql.rds_configuration.name = BINARY name;
   SET @@sql_log_bin = sql_logging;
END
star

Fri Nov 19 2021 08:45:09 GMT+0000 (Coordinated Universal Time) https://www.reddit.com/r/aws/comments/gj1i1u/permanently_setting_binlog_retention_period_on/

#mysql #binlog

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension