= MySql HowTo log SQL errors Tags: [[MySql]] [[HowTo]] == Introduction The 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. == Procedure === Install MySQL-Proxy 1. Download the latest tar file from [[https://downloads.mysql.com/archives/proxy/]] 2. Unzip the file using the command `sudo tar zxf mysql-proxy-0.8.5-linux-debian6.0-{version}.tar.gz -C /usr/local` === Create the lua script to log the error and run. 1. Copy the script from here: [[http://www.chriscalender.com/capturing-erroneous-queries-with-mysql-proxy/]] 2. Run the mysql proxy command. For example: {{{ /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 }}} 3. Change the connection string of the clinet application to use the new port (4045). [[BackLinks]]