How to log or see all MySQL errors?
In PHP, consider using

error_log($str);


It will write to the web server's log file.

$str should be constructed from diagnostics provided by MySQL or php.  You might consider prefixing the string with some keyword to make the log file more easily searchable.

Alas, this means identifying all places in your code that might have "errors" or "warnings" and adding code to grab the relevant message.  But it does put all the messages into a central location for later study.