Created
          June 26, 2020 09:24 
        
      - 
      
 - 
        
Save sysadminbp/4836196f51b21e5a12f6af149c5cc949 to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | SHOW GLOBAL VARIABLES LIKE 'expire_logs_days' ; - shows how much days are set now | |
| ====== | |
| SET GLOBAL expire_logs_days = 3; - sets variable for 3 days | |
| /etc/my.cnf: | |
| [mysqld] | |
| expire_logs_days=3 | |
| ========= | |
| PURGE BINARY LOGS BEFORE DATE(NOW() - INTERVAL 3 DAY) + INTERVAL 0 SECOND; - this will erase all binary logs before midnight 3 days ago. | |
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment