Original link: http://www.qqdeveloper.com/detail/11/1.html
Why do I need to log SQL records
The main purpose is to detect our website security issues, to effectively avoid some SQL injection or XSS attacks.
How to Achieve
The main example of this is the My.ini file in the Windows system, where the configuration file for the Linux system is my.conf, with 5.6 for example.
? Mode one
? ? log = "D:/wamp64/logs/mysql.log"//day log file
? Log_slow_queries = "D:/wamp64/logs/mysql.log"//log query length files
? ? long_query_time = 1//query duration
? Mode two,
? ? general_log = On
? ? general_log_file = "D:/wamp64/logs/mysql.log"
? method three, through the command line implementation
?? First, log in to MySQL via our terminal. Enter the following command to open it.
?? Set global general_log = on;
?? Set GLOBAL log_output = ' table ';
Configuration considerations
A log directory must be present in advance or the log cannot be logged. There's a situation here too. C:/temp directory must already exist
B log file is the text of the Linux format, it is recommended to open with UltraEdit, converted to DOS format view (otherwise there is no line break, can not understand)
The C service cannot delete the log file while it is in the startup state, or the SQL statement cannot be logged.
D can not use UltraEdit directly to clear the contents of the file after saving, otherwise it will not be recorded. The service needs to be restarted if UltraEdit has saved. Bak and is logged to this file.
E can be saved after clearing the text with Notepad, and the log can continue to be recorded.
may be wrongly explained
? 1. When we adopt mode one, we may prompt the following similar error message (the error message is viewed in the MySQL default log file)
? Option ' General_log ': boolean value ' on; ' wasn ' t recognized. Set to OFF.
?? The workaround uses configuration mode two, which is caused by different versions of MySQL.
? 2. When we use the second mode configuration, we may prompt the following similar error message.
? Option ' General_log ': boolean value ' on; ' wasn ' t recognized. Set to OFF.
? The solution is to change our on configuration value to 1, which is caused by different versions of MySQL.
? 3. The same type of usage one configuration is that the following similar information may appear.
? ? Unknown variable ' log=d:/wamp64/logs/mysql.log '
? Solution Reference Link, the reason for the change is different version
?
?
?
How MySQL Configures SQL records