|
In project development, will inevitably encounter on the database server to perform tracking sql statement needs by tracking sql statement is executed, we can determine when the upper application in the implementation of sql statement, the database end whether to execute the sql statement, execute the sql statement if there is an error, and so on. In short, the end of the tracking database sql statement is executed greatly facilitated the logical database coding error in the investigation.
We all know that in SQL SERVER tracking using sql profiler, then in MySQL How to track the sql statement executed?
By some google, baidu, found a simple but not the ultimate solution.
Solution
1, the idea is very simple: open the MySQL log log function, by looking at the logs to trace.
2, open the MySQL log log method:
[Configure Windows environment]
Find my.ini in Mysql server installation directory, I was in: The next "C \ Program Files \ MySQL \ MySQL Server 5.5" directory,
Find [mysqld] field in my.ini, and add the following: log = path to store the log /mysql.log
My configuration:
After modifying my.ini done, save the file, restart mysql service to the C: found mysql.log file / Users / Administrator /.
In MySQL client executes a sql statement to see mysql.log logs to realize the sql statement tracking. |
|
|
|