• <tfoot id='YCXuh'></tfoot>
        <bdo id='YCXuh'></bdo><ul id='YCXuh'></ul>

      <small id='YCXuh'></small><noframes id='YCXuh'>

      <i id='YCXuh'><tr id='YCXuh'><dt id='YCXuh'><q id='YCXuh'><span id='YCXuh'><b id='YCXuh'><form id='YCXuh'><ins id='YCXuh'></ins><ul id='YCXuh'></ul><sub id='YCXuh'></sub></form><legend id='YCXuh'></legend><bdo id='YCXuh'><pre id='YCXuh'><center id='YCXuh'></center></pre></bdo></b><th id='YCXuh'></th></span></q></dt></tr></i><div id='YCXuh'><tfoot id='YCXuh'></tfoot><dl id='YCXuh'><fieldset id='YCXuh'></fieldset></dl></div>

      <legend id='YCXuh'><style id='YCXuh'><dir id='YCXuh'><q id='YCXuh'></q></dir></style></legend>

      1. 使用 JDBC 启用 MySQL 通用查询日志

        Enabling MySQL general query log with JDBC(使用 JDBC 启用 MySQL 通用查询日志)

            <legend id='NaTnM'><style id='NaTnM'><dir id='NaTnM'><q id='NaTnM'></q></dir></style></legend>

                <small id='NaTnM'></small><noframes id='NaTnM'>

              1. <tfoot id='NaTnM'></tfoot>

              2. <i id='NaTnM'><tr id='NaTnM'><dt id='NaTnM'><q id='NaTnM'><span id='NaTnM'><b id='NaTnM'><form id='NaTnM'><ins id='NaTnM'></ins><ul id='NaTnM'></ul><sub id='NaTnM'></sub></form><legend id='NaTnM'></legend><bdo id='NaTnM'><pre id='NaTnM'><center id='NaTnM'></center></pre></bdo></b><th id='NaTnM'></th></span></q></dt></tr></i><div id='NaTnM'><tfoot id='NaTnM'></tfoot><dl id='NaTnM'><fieldset id='NaTnM'></fieldset></dl></div>
                • <bdo id='NaTnM'></bdo><ul id='NaTnM'></ul>
                    <tbody id='NaTnM'></tbody>
                  本文介绍了使用 JDBC 启用 MySQL 通用查询日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  有没有办法通过 JDBC 启用 MySQL 常规查询日志记录?我通过搜索发现的最接近的是能够通过 JDBC (http://dev.mysql.com/doc/refman/5.5/en/connector-j-reference-configuration-properties.html) 记录慢查询.也许我应该这样做并将慢查询阈值设置为 0 毫秒?

                  Is there a way to enable MySQL general query logging through JDBC? The closest thing I have found through my search is the ability to log slow queries through JDBC (http://dev.mysql.com/doc/refman/5.5/en/connector-j-reference-configuration-properties.html). Maybe I should do that and set the slow query threshold to 0 ms?

                  我想以人类可读的格式记录通过 MySQL 的所有查询,并想指定应该写入日志文件的位置.我知道我的性能会受到影响,但我的应用程序只有一个用户,而且非常简单,如果性能受到明显影响,我会感到惊讶.反正我想试试看.

                  I would like to log all queries through MySQL in a human-readable format and would like to specify the location where the log file should be written. I know I will take a performance hit, but my application only has one user and is simple enough that I would be surprised if the performance hit was noticeable. I would like to try it out anyway to see.

                  我相信我的另一个选择是打开二进制日志记录并使用 mysqlbinlog 将二进制日志转换为人类可读的格式,但听起来通用查询日志将提供一种更简单的方法来获取我想要的内容.

                  I believe another option I have is to turn on binary logging and use mysqlbinlog to convert the binary logs to a human-readable format, but it sounds like the general query log would provide a simpler means of getting what I want.

                  推荐答案

                  我最终找到了解决方法.我通过在运行时使用以下 SQL 查询修改 MySQL 全局系统变量来通过 Java 启用 MySQL 常规查询日志记录.

                  I ended up finding a workaround. I enable MySQL general query logging through Java by modifying MySQL global system variables at runtime with the following SQL queries.

                  SET GLOBAL log_output="FILE"
                  SET GLOBAL general_log_file="Path/File"
                  SET GLOBAL general_log='ON'
                  

                  我建议在 general_log_file 路径中使用正斜杠.即使在 Windows 环境中,我也无法使用反斜杠.

                  I recommend using forward slashes in the general_log_file path. I could not get backslashes to work, even in a Windows environment.

                  我在运行时使用以下 SQL 查询禁用了一般查询日志记录.

                  I disable general query logging at runtime with the following SQL query.

                  SET GLOBAL general_log='OFF'
                  

                  这篇关于使用 JDBC 启用 MySQL 通用查询日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
                  What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                  MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
                  MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
                  Why Mysql#39;s Group By and Oracle#39;s Group by behaviours are different(为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同)
                  MySQL GROUP BY DateTime +/- 3 seconds(MySQL GROUP BY DateTime +/- 3 秒)

                • <small id='dL77m'></small><noframes id='dL77m'>

                      <tbody id='dL77m'></tbody>
                  • <tfoot id='dL77m'></tfoot>
                    <legend id='dL77m'><style id='dL77m'><dir id='dL77m'><q id='dL77m'></q></dir></style></legend>
                      • <i id='dL77m'><tr id='dL77m'><dt id='dL77m'><q id='dL77m'><span id='dL77m'><b id='dL77m'><form id='dL77m'><ins id='dL77m'></ins><ul id='dL77m'></ul><sub id='dL77m'></sub></form><legend id='dL77m'></legend><bdo id='dL77m'><pre id='dL77m'><center id='dL77m'></center></pre></bdo></b><th id='dL77m'></th></span></q></dt></tr></i><div id='dL77m'><tfoot id='dL77m'></tfoot><dl id='dL77m'><fieldset id='dL77m'></fieldset></dl></div>

                            <bdo id='dL77m'></bdo><ul id='dL77m'></ul>