This article will introduce you to a more useful function, that is, to record the SQL statements executed by MySQL in real time, so that we can easily troubleshoot various injection problems.
The method is simple: edit/etc/my. in the cnf file, add the log =/var/lib/mysql/SQL _row.log line under the [mysqld] section (the log Path is defined as needed ).
The Code is as follows: |
Copy code |
[Mysqld] Datadir =/var/lib/mysql Socket =/var/lib/mysql. sock User = mysql # Default to using old password format for compatibility with mysql 3.x # Clients (those using the mysqlclient10 compatibility package ). Old_passwords = 1 Log =/var/lib/mysql/SQL _row.log # Disabling symbolic-links is recommended to prevent assorted security risks; # To do so, uncomment this line: # Symbolic-links = 0 [Mysqld_safe] Log-error =/var/log/mysqld. log Pid-file =/var/run/mysqld. pid |
After modification, restart MySQL:
The Code is as follows: |
Copy code |
Service mysql restart # Or /Etc/init. d/mysqld stop /Etc/init. d/mysqld start |
Now you can go to the SQL _row.log file in the/var/lib/mysql/path to see when MySQL has executed the programs.