我使用的是windows 7和MySQL workbench 6.3
因此,当我开始设置日志文件时,我可以在其中获取在MySQL数据库上触发的所有查询。我卡得太厉害了。
C:\Program Files\MySQL1\MySQL Server5.7,之后应该会有任何my.ini文件,根据谷歌上数百万篇文章的说法。但是我有我的-default.ini。:(
这是我的my-default.ini文件
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
log=file.log
general-log=1
general-log-file=file.log我刚刚添加了最后3行,这样我就可以在file..but中获得日志,即使是bin中的文件file.log也没有得到任何东西。
有没有人能帮我设置一下?提前感谢!!
发布于 2016-02-04 14:03:08
首先执行下面的命令来启动通用日志-
SET general_log=ON;现在,通过以下命令检查您的服务器将它们写入的位置-
SHOW VARIABLES LIKE 'general_log_file';现在转到服务器,您可以阅读这些日志,在linux中,您可以使用tail命令-
tail -f /var/log/mysqd_query.log 注意:这里的路径和文件是var/log/mysqd_query.log
https://stackoverflow.com/questions/35193539
复制相似问题