Home  >  Article  >  Database  >  MySQL之慢查询-删除慢查询日志_MySQL

MySQL之慢查询-删除慢查询日志_MySQL

WBOY
WBOYOriginal
2016-06-01 13:09:58822browse

一、环境

OS:CentOS release 5.8(64位)

DB:MySQL5.5.17

二、操作

直接通过命令 rm -f 删除了慢查询日志

三、出现问题

慢查询日志没有自动生成,(如果有备份,再次拷贝回来也是不好使的)

四、解决方法

管理员身份登录MySQL 执行命令 flush logs;

如果执行后,提示执行成功,而实际上慢查询日志还是没有生成,则执行以下命令(先关闭慢查询,再开启)

SET GLOBAL log_slow_queries = off;(关闭慢查询)
SET GLOBAL log_slow_queries = ON;(重开启慢查询)

问题解决,OK!

五、建议

如果遇到慢查询日志文件过大,需要回收空间加以利用,或者其他原因需要删除慢查询日志文件,建议不要直接 rm 掉慢查询日志文件,可以置空日志文件,

如:>mysql-slow.log

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn