Changes between Initial Version and Version 1 of MySql HowTo log SQL errors


Ignore:
Timestamp:
01/27/17 09:25:02 (8 years ago)
Author:
Richard Bramley
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MySql HowTo log SQL errors

    v1 v1  
     1= MySql HowTo log SQL errors
     2
     3Tags: [[MySql]] [[HowTo]]
     4
     5== Introduction
     6
     7The MySQL error log only contains errors experienced by MySQL and not queries that cause an error.  And because PHP tries to make development as hard as possible, it quite often hides what errors are being returned from MySQL, either with a WSOD or with the helpful 'Unknown Error' message.  Therefore, the only way to see what error is being produced is to use mysql-proxy to sit between the client and MySQL and create LUA script to display the error messages.
     8
     9== Procedure
     10
     11=== Install MySQL-Proxy
     12
     131. Download the latest tar file from [[https://downloads.mysql.com/archives/proxy/]]
     142. Unzip the file using the command `sudo tar zxf mysql-proxy-0.8.5-linux-debian6.0-{version}.tar.gz -C /usr/local`
     15
     16=== Create the lua script to log the error and run.
     17
     181. Copy the script from here: [[http://www.chriscalender.com/capturing-erroneous-queries-with-mysql-proxy/]]
     192. Run the mysql proxy command.  For example:
     20
     21{{{
     22/usr/local/mysql-proxy-0.8.5-linux-debian6.0-x86-64bit/bin/mysql-proxy --proxy-backend-addresses=127.0.0.1:3306 --proxy-address=0.0.0.0:4045 --proxy-lua-script=/home/richard/mysql_proxy_log_errors.lua
     23}}}
     24
     253. Change the connection string of the clinet application to use the new port (4045).
     26
     27[[BackLinks]]