mysql> show variables like 'expire_logs_days'; +------------------+-------+ | Variable_name | Value | +------------------+-------+ | expire_logs_days | 0 | +------------------+-------+
1 2
-- 设置binlog7天后自动清理 mysql> set global expire_logs_days=7;
数据文件
查看各个表的数据文件大小使用如下命令:
1 2 3 4 5 6 7 8
-- 查询共享表空间ibdata1,业务表相关个文件大小(不包含redo) SELECT file_name, concat(TOTAL_EXTENTS,'M') as 'File_size' FROM INFORMATION_SCHEMA.FILES order by TOTAL_EXTENTS DESC;
-- 查询不包含redo类日志的其他文件总大小 SELECT sum(concat(TOTAL_EXTENTS,'M')) as 'File_size' FROM INFORMATION_SCHEMA.FILES;
-- 看是否慢日志比较多,也会占用磁盘 select count(*) from mysql.slow_log;