Chinaunix首页 | 论坛 | 博客
  • 博客访问: 388797
  • 博文数量: 166
  • 博客积分: 1972
  • 博客等级: 上尉
  • 技术积分: 1845
  • 用 户 组: 普通用户
  • 注册时间: 2010-07-19 21:16
文章分类

全部博文(166)

文章存档

2013年(7)

2010年(159)

分类: LINUX

2010-10-12 16:06:31

  • mysql> show variables like '%log%';
  • +---------------------------------+------------------------------------+
  • | Variable_name | Value |
  • +---------------------------------+------------------------------------+
  • | back_log | 50 |
  • | binlog_cache_size | 32768 |
  • | binlog_format | MIXED |
  • | expire_logs_days | 0 |
  • | general_log | OFF |
  • | general_log_file | /usr/local/mysql/var/dev.log |
  • | innodb_flush_log_at_trx_commit | 1 |
  • | innodb_locks_unsafe_for_binlog | OFF |
  • | innodb_log_buffer_size | 1048576 |
  • | innodb_log_file_size | 5242880 |
  • | innodb_log_files_in_group | 2 |
  • | innodb_log_group_home_dir | ./ |
  • | innodb_mirrored_log_groups | 1 |
  • | log | OFF |
  • | log_bin | ON |
  • | log_bin_trust_function_creators | OFF |
  • | log_bin_trust_routine_creators | OFF |
  • | log_error | /usr/local/mysql/var/dev.err |
  • | log_output | FILE |
  • | log_queries_not_using_indexes | OFF |
  • | log_slave_updates | OFF |
  • | log_slow_queries | ON |
  • | log_warnings | 1 |
  • | max_binlog_cache_size | 18446744073709547520 |
  • | max_binlog_size | 1073741824 |
  • | max_relay_log_size | 0 |
  • | relay_log | |
  • | relay_log_index | |
  • | relay_log_info_file | relay-log.info |
  • | relay_log_purge | ON |
  • | relay_log_space_limit | 0 |
  • | slow_query_log | ON |
  • | slow_query_log_file | /usr/local/mysql/var/slowquery.log |
  • | sql_log_bin | ON |
  • | sql_log_off | OFF |
  • | sql_log_update | ON |
  • | sync_binlog | 0 |
  • +---------------------------------+------------------------------------+
  • 37 rows in set (0.00 sec)
  •  
  • mysql> show binary logs;
  • +------------------+------------+
  • | Log_name | File_size |
  • +------------------+------------+
  • | mysql-bin.000037 | 122272086 |
  • | mysql-bin.000038 | 1073752203 |
  • | mysql-bin.000039 | 387324827 |
  • | mysql-bin.000040 | 1073741879 |
  • | mysql-bin.000041 | 1074498356 |
  • | mysql-bin.000042 | 1074475113 |
  • | mysql-bin.000043 | 1073923177 |
  • | mysql-bin.000044 | 359009653 |
  • +------------------+------------+
  • 8 rows in set (0.00 sec)
  •  
  • mysql> purge binary logs to 'mysql-bin.000041';
  • Query OK, 0 rows affected (4.31 sec)
  •  
  • mysql> show binary logs;
  • +------------------+------------+
  • | Log_name | File_size |
  • +------------------+------------+
  • | mysql-bin.000041 | 1074498356 |
  • | mysql-bin.000042 | 1074475113 |
  • | mysql-bin.000043 | 1073923177 |
  • | mysql-bin.000044 | 359010115 |
  • +------------------+------------+
  • 4 rows in set (0.00 sec)
  •  
  • mysql> set global expire_logs_days=3;
  • Query OK, 0 rows affected (0.06 sec)
  •  
  •  
  • /etc/my.cnf
  • add
  • expire_logs_days = 3
  • 这里需要重启 但尚未重启 等待下次重启即可生效
  • 阅读(1579) | 评论(1) | 转发(0) |
    给主人留下些什么吧!~~

    chinaunix网友2010-10-14 17:22:40

    很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com