views:

99

answers:

1

I know that there is general_log that logs all queries, but I want to find out which query has an error, and get the error message. I have tried running an error query on purpose, but it logs as a normal query and doesn't report it with error. Any ideas?

+1  A: 

I have tried running an error query on purpose, but it logs as a normal query and doesn't report it with error. Any ideas?

so, you did it wrong. No other idea without the code.

in PHP I'm doing it this way (assume you're using mysql driver):

$res=mysql_query($sql) or trigger_error(mysql_error().$sql);

it will log all erroneous queries if you have log_errors setting on (and you have to)

EDIT: I see now, you want global level logging,m not application level. But may be application level will suit you as well?

Col. Shrapnel
I input sql through phpmyadmin 3.3.2 are they doing it wrong?
Kaizoku
@user phpmyadmin is single-user application, thus it don't need any logging.
Col. Shrapnel
I see now, edited my answer
Col. Shrapnel
Does trigger_error write to mysql log or php log? Because I got shell scripts that use mysql as well.
Kaizoku
@user that's php directive. It's writing into standard PHP error log.
Col. Shrapnel
thanks for answer, but does not solve my problem, this is php dependent.
Kaizoku