【问题标题】:How to see the query logs of Mysql in Windows 8.1Windows 8.1如何查看Mysql的查询日志
【发布时间】:2013-11-19 01:01:33
【问题描述】:

我想查看 mysql 服务器中正在执行的查询,我找到了解决方案但我的日志文件被隐藏了,我试图更改 Windows 属性但文件仍然隐藏,我该怎么办?

我正在使用 Windows 8.1 64 位和 Mysql WorkBench 与服务器 5.6

mysql> show variables like '%general%';

+------------------+-----------+
| Variable_name    | Value     |
+------------------+-----------+
| general_log      | ON        |
| general_log_file | DIEGO.log |
+------------------+-----------+
2 rows in set (0.00 sec)

【问题讨论】:

    标签: mysql windows mysql-workbench


    【解决方案1】:

    查找查询日志的位置:

    mysql> show variables like '%general%';
    +------------------+---------------------------------------+
    | Variable_name    | Value                                 |
    +------------------+---------------------------------------+
    | general_log      | OFF                                   |
    | general_log_file | /path/to/log                        |
    +------------------+---------------------------------------+
    

    并打开查询日志:

    mysql> SET GLOBAL general_log  = 'ON';
    Query OK, 0 rows affected (0.00 sec)
    

    然后,重新运行show variables like '%general%',然后'general_log' 为ON。

    【讨论】:

    • 对不起,我只使用 Linux 服务器。但是 MySQL 说The C:\ProgramData directory is hidden by default. You must change your folder options to view the hidden file. Choose Organize, Folder and search options, Show hidden folders.。这可能会对您有所帮助。
    • 您可以更改日志路径。 SET GLOBAL general_log_file = '/path/to';。设置日志路径就可以看到了。
    • 好的,但是 path 和 to,是什么?我只需要把上面的命令放上去运行?
    • 是的,SET GLOBAL general_log_file = 'C:\some_folder\log_filename'。 some_folder 在运行SET ... 之前必须存在,并且运行mysql 查询。然后你可以看到它查询日志文件。
    • 谢谢,我在%systemroot% 中放了一个文件夹,但在Windows 中,命令必须是这样的,SET GLOBAL general_log_file = 'C:/some_folder/log_filename'...谢谢
    【解决方案2】:

    如果有人在使用 MySqlWorkBench,我找到了其他方法。

    打开MysqlWorkBench,打开服务器状态页面。

    单击 em 选项文件,然后单击选项卡日志记录。

    点击general_log_file,然后选择该文件的存放位置。

    你可以看到日志文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-09-22
      • 1970-01-01
      • 2011-07-23
      • 2023-03-13
      • 2012-09-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-05
      相关资源
      最近更新 更多