If you've set a log path in the Control Panel (CP -> Master Settings -> Primary -> Logging -> Database Error Logging) then it'll be in the log file; if not then you can change the following line (~Line 296, depending on version):
In /libs/mysqli.inc.php find:
Replace With:
I would highly advise not leaving this option on as it could potentially show private information about your install. I would also highly advise setting the Database Error Logging path if it has not already been enabled.