mysql慢日志问题

storyxsj 2009-10-23 09:34:33
hi,
在配置文件中配置了慢日志,但是到目标文件夹下查看却没有,请问哪里出问题了

1.配置文件
log-slow-queries="D:/mysql/slowlog"
long_query_time=0.01
log-queries-not-using-indexes

2.查询结果
| 5 | 10 | 2009-09-22 15:29:25 |
| 8 | 3 | 2009-09-21 14:30:06 |
| 10 | 2232 | 2009-09-22 14:27:21 |
| 11 | 2123 | 2009-09-22 14:27:25 |
| 12 | 34 | 2009-09-22 14:27:32 |
+------+------+---------------------+
19290 rows in set (0.08 sec)

...全文
157 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
懒得去死 2009-10-23
  • 打赏
  • 举报
回复
看手册吧。
storyxsj 2009-10-23
  • 打赏
  • 举报
回复
知道了,我自己的问题

log-slow-queries="D:/mysql/slowlog"
slowlog指的是文件名,其实我己经在D:/mysql下建了文件夹,重复了

修改为,下面的就OK了
#add by xinsj on 20091022 for slow log
log-slow-queries="D:/mysql/slowlog/slowlog"
#log-slow-queries
long_query_time=0.01
#log-queries-not-using-indexes

添麻烦了,多谢!
ACMAIN_CHM 2009-10-23
  • 打赏
  • 举报
回复
Prior to MySQL 5.1.21, the minimum value is 1, and the value for this variable must be an integer. Beginning with MySQL 5.1.21, the minimum is 0, and a resolution of microseconds is supported when logging to a file. However, the microseconds part is ignored and only integer values are written when logging to tables.

你的版本没有问题。 | 5.1.23-rc-community-log |

这样 检查一下你的 datadir; 有没有这个log.
mysql> select @@datadir;
+-----------------------------------------------+
| @@datadir |
+-----------------------------------------------+
| C:\Program Files\MySQL\MySQL Server 5.1\DATA\ |
+-----------------------------------------------+
1 row in set (0.00 sec)

mysql>
denniswwh 2009-10-23
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 storyxsj 的回复:]
引用 4 楼 denniswwh 的回复:
mysql的官方版本是不是不能记录小于1秒的慢查询的,long_query_time只能大于等于1


当初也怀疑是这个,我再查查
[/Quote]

不过5.1.21之后是支持0.1这样的毫秒级的
storyxsj 2009-10-23
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 denniswwh 的回复:]
mysql的官方版本是不是不能记录小于1秒的慢查询的,long_query_time只能大于等于1
[/Quote]

当初也怀疑是这个,我再查查
storyxsj 2009-10-23
  • 打赏
  • 举报
回复
mysql> exit;
Bye

D:\mysql\slowlog>dir
驱动器 D 中的卷是 D
卷的序列号是 881B-DFA6

D:\mysql\slowlog 的目录

2009-10-22 16:48 <DIR> .
2009-10-22 16:48 <DIR> ..
0 个文件 0 字节
2 个目录 5,151,195,136 可用字节
denniswwh 2009-10-23
  • 打赏
  • 举报
回复
mysql的官方版本是不是不能记录小于1秒的慢查询的,long_query_time只能大于等于1
storyxsj 2009-10-23
  • 打赏
  • 举报
回复
没看出什么问题
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>
mysql> show variables like 'long_query_time';
+-----------------+----------+
| Variable_name | Value |
+-----------------+----------+
| long_query_time | 0.010000 |
+-----------------+----------+
1 row in set (0.00 sec)

mysql> show variables like '%slow%';
+---------------------+------------------+
| Variable_name | Value |
+---------------------+------------------+
| log_slow_queries | ON |
| slow_launch_time | 2 |
| slow_query_log | ON |
| slow_query_log_file | D:/mysql/slowlog |
+---------------------+------------------+
4 rows in set (0.00 sec)

mysql> show variables like 'log_output';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_output | FILE |
+---------------+-------+
1 row in set (0.00 sec)

mysql> select version();
+-------------------------+
| version() |
+-------------------------+
| 5.1.23-rc-community-log |
+-------------------------+
1 row in set (0.00 sec)
ACMAIN_CHM 2009-10-23
  • 打赏
  • 举报
回复
你的 long_query_time 设置应该是不对的。

检查一下你的以下信息。


mysql> show variables like 'long_query_time';
+-----------------+-----------+
| Variable_name | Value |
+-----------------+-----------+
| long_query_time | 10.000000 |
+-----------------+-----------+
1 row in set (0.06 sec)

mysql> show variables like '%slow%';
+---------------------+-------+
| Variable_name | Value |
+---------------------+-------+
| log_slow_queries | ON |
| slow_launch_time | 2 |
| slow_query_log | ON |
| slow_query_log_file | |
+---------------------+-------+
4 rows in set (0.00 sec)

mysql> show variables like 'log_output';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_output | FILE |
+---------------+-------+
1 row in set (0.00 sec)

mysql> select version();
+----------------------+
| version() |
+----------------------+
| 5.1.33-community-log |
+----------------------+
1 row in set (0.00 sec)

mysql>

WWWWA 2009-10-23
  • 打赏
  • 举报
回复
SET global log_output=file

56,687

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧