MySQL Log Query Errors

This is a simple MySQL setup question when registering failed SQL attempts. I need a solution to register failed SQL queries in a MySQL database.

MySQL's general query log does not work here, since it will only log successful requests. I need to know failed in another log file.

My scenario: I need to clear large messy SQL and PHP scripts (literally, about 7000 SQL queries are executed on each page). Because errors are suppressed on the server, even queries with SQL query errors will continue and display on the website. But I'm sure there are many SQL errors. I found 2 links, but cannot retry. This and writing a server side revision in MySQL.

Uses Kontrolbase as mentioned here .

+4
source share
1 answer

Percona Server 5.5.37 5.6.17 , . : http://www.percona.com/doc/percona-server/5.6/management/audit_log_plugin.html

, . , foo, foobar:

<AUDIT_RECORD
  "NAME"="Query"
  "RECORD"="489_2014-05-23T14:06:09"
  "TIMESTAMP"="2014-05-23T14:08:13 UTC"
  "COMMAND_CLASS"="select"
  "CONNECTION_ID"="32709"
  "STATUS"="0"
  "SQLTEXT"="select * from foo"
  "USER"="root[root] @ localhost []"
  "HOST"="localhost"
  "OS_USER"=""
  "IP"=""
/>
<AUDIT_RECORD
  "NAME"="Query"
  "RECORD"="490_2014-05-23T14:06:09"
  "TIMESTAMP"="2014-05-23T14:08:19 UTC"
  "COMMAND_CLASS"="select"
  "CONNECTION_ID"="32709"
  "STATUS"="1146"
  "SQLTEXT"="select * from foobar"
  "USER"="root[root] @ localhost []"
  "HOST"="localhost"
  "OS_USER"=""
  "IP"=""
/>

STATUS=1146 . . http://dev.mysql.com/doc/refman/5.6/en/error-messages-server.html, . , 1146 - ER_NO_SUCH_TABLE.

, PHP-, .

0

Source: https://habr.com/ru/post/1541960/


All Articles