I AM NOT RUNNING THE COMMANDS FROM PHP!
I have MySQL log_error value set to /var/log/mysql/error.log
However when I connect to a database and run an SQL command,
Error log doesn't do that: https://dev.mysql.com/doc/refman/8.0/en/error-log.html
The error log contains information indicating when mysqld was started and stopped and also any critical errors that occur while the server is running.
MySQL doesn't log invalid/failed queries anywhere.
If it's for debugging purposes, you might try setting up a MySQL Proxy, which could log this I think:
http://dev.mysql.com/downloads/mysql-proxy/