清除mysql的日志的方法
2019/10/10/17:32:51 阅读:1846 来源:谷歌SEO算法 标签:
黑猫SEO
下面介绍一下关于mysql日志的清除方法,下面不说多,#的行是注释下面的是真实的例子,可供参考.
- [root@aslibrawww.aslibra.com]#mysql-S/Data/www.aslibra.com/mysql/mysql.sock-uadmin-ppassword
- WelcometotheMySQLmonitor.Commandsendwith;org.
- YourMySQLconnectionidis322891
- Serverversion:5.5.2-m2-logSourcedistribution
- Type'help;'or'h'forhelp.Type'c'toclearthecurrentinputstatement.
#显示当前所有日志,代码如下:
- mysql>showmasterlogs;
- +------------------+------------+
- |Log_name|File_size|
- +------------------+------------+
- |mysql-bin.000001|126|
- |mysql-bin.000002|1074328576|
- |mysql-bin.000003|918443740|
- |mysql-bin.000004|126|
- |mysql-bin.000005|126|
- |mysql-bin.000006|109880744|
- +------------------+------------+
- 6rowsinset(0.00sec)
#删除日志到某一个,不能超过最后一个,代码如下:
mysql> purge master logs to 'mysql-bin.000027';
ERROR 1373 (HY000):Target log not found in binlog index
#删除日志到最后一个即可,代码如下:
mysql> purge master logs to 'mysql-bin.000006';
Query OK, 0 rows affected (3.80 sec)
#看看现在的情况,代码如下:
- mysql>showmasterlogs;
- +------------------+-----------+
- |Log_name|File_size|
- +------------------+-----------+
- |mysql-bin.000006|109884395|
- +------------------+-----------+
- 1rowinset(0.00sec)
- --phpfensi.com
#退出,代码如下:mysql> exit
热门评论