To fetch last query executed on mysql or check the executed queries logs.
Query history output in table
SET GLOBAL log_output = 'TABLE';
SET GLOBAL general_log = 'ON';
log_output = 'TABLE' enable the output in general_log table
general_log = 'ON', set it to ON start print queries in log table
and general_log = 'OFF' stop print queries in log table
SELECT * FROM mysql.general_log
general_log table have logs of executed queries.
Query history output in file
SET GLOBAL log_output = "FILE";
SET GLOBAL general_log_file = "/path/to/your/logfile.log";
SET GLOBAL general_log = 'ON';
set variable log_output='FILE' to print output in file
set path in general_log_file variable and set general_log to ON