查看传入 MySQL 服务器的查询请求

发布于 2024-08-02 14:51:28 字数 287 浏览 3 评论 0原文

有没有一种方法可以查看传入 mysql 服务器的查询请求。我有一个场景,我的 asp.net 应用程序拒绝执行查询,但相同的查询在 mysql 查询浏览器内执行。我已经安装了 mysql dotnet 连接器(5.0.9),通过它我可以连接到数据库。

我已经提到页面,但我想这只能在mysql 会话。 mysql 服务器托管在 centos 机器上。

is there a way we can view the incoming query requests to mysql server. I have a scenario where my asp.net application refuses to execute a query, but the same query executes inside of a mysql query browser. I have installed the mysql dotnet connector (5.0.9) via which I can conncet to the database.

I have referred this page, but I guess this will only work within the mysql session. The mysql server is hosted on a centos machine.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

一人独醉 2024-08-09 14:51:28

听起来你想要 mysql 查询日志

编辑:试试这个:

  1. 在 /etc/mysql/my.cnf 中编辑 my.cnf
  2. /etc/init.d/mysql restart
  3. 在 /var/log/mysql 中查找

Sounds like you want the mysql query log

Edit: Try this:

  1. Edit my.cnf in /etc/mysql/my.cnf
  2. /etc/init.d/mysql restart
  3. Look in /var/log/mysql
画尸师 2024-08-09 14:51:28

按照 Tom Ritter 提到的步骤进行操作。更具体地说...

在编辑/etc/m.cnf(这是您的mysql配置信息所在的位置)时,找到一个显示mysqld的部分。在此下方键入以下内容:

log=/var/log/mysql/generalquerylog.log

按照 Tom Ritter 的帖子中提到的方式执行其余操作。

Followed the steps mentioned by Tom Ritter. To be more specific...

While editing /etc/m.cnf (this is where ur mysql config info sits) find a section that says mysqld. Just below that type the following:

log=/var/log/mysql/generalquerylog.log

Do a the rest as mentioned in Tom Ritter's post.

吐个泡泡 2024-08-09 14:51:28

在 Windows 上,您可以按照以下步骤配置 MySQL 服务器实例以记录所有传入查询:

  • 打开 MySQL 服务器配置文件,默认情况下该文件应位于以下路径:“%SystemDrive%\ProgramData\ MySQL\MySQL Server 5.7\my.ini”(请注意,5.7 是版本号,可能会根据实例的版本而有所不同)

  • 找到配置脚本的以下部分:

    # 常规和慢速日志记录。
    日志输出=文件
    通用日志=0
    General_log_file="LAPTOP-123456.log"
    慢查询日志=1
    Slow_query_log_file="LAPTOP-678901-slow.log"
    长查询时间=10
    
  • 将代码片段的第三行更改为

    general-log=0 
    

    general-log=1
    
  • Restart your MySQL server

从此以后,所有传入 MySQL 服务器的查询都将写入位于以下位置的文件:以下路径:“%SystemDrive%\ProgramData\MySQL\MySQL Server 5.7\Data\LAPTOP-123456.log”。注意文件名与配置脚本中general_log_file的值相同

On windows, you can configure a MySQL server instance to log all incoming queries by following the steps below:

  • Open your MySQL server configuration file which by default should live at the following path: "%SystemDrive%\ProgramData\MySQL\MySQL Server 5.7\my.ini" (note that 5.7 is the version number and could vary based on the version of your instance)

  • Locate the following portion of the configuration script:

    # General and Slow logging.
    log-output=FILE
    general-log=0
    general_log_file="LAPTOP-123456.log"
    slow-query-log=1
    slow_query_log_file="LAPTOP-678901-slow.log"
    long_query_time=10
    
  • Change the third line of the code snippet from

    general-log=0 
    

    to

    general-log=1
    
  • Restart your MySQL server

Henceforth, all incoming queries to your MySQL server will be written to the file at the following path: "%SystemDrive%\ProgramData\MySQL\MySQL Server 5.7\Data\LAPTOP-123456.log". Note that the file name is the same as the value of general_log_file in the configuration script

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文