我发出了一个查询,并在mysql>
命令行中得到了结果。
有什么方法(编辑除外)我可以看到最后一个查询是什么?
我依稀记得在Oracle pl / sql中你可以输入list
但是这个命令在mysql中不可用(语法错误)
答案 0 :(得分:0)
Additionally, for those blessed with MySQL >= 5.1.12:
Execute SET GLOBAL log_output = 'TABLE';
Execute SET GLOBAL general_log = 'ON';
Take a look at the table mysql.general_log
If you prefer to output to a file:
SET GLOBAL log_output = "FILE"; which is set by default.
SET GLOBAL general_log_file = "/path/to/your/logfile.log";
SET GLOBAL general_log = 'ON';
I prefer this method because:
you're not editing the my.cnf file and potentially permanently turning on logging
you're not fishing around the filesystem looking for the query log - or even worse, distracted by the need for the perfect destination. /var/log /var/data/log /opt /home/mysql_savior/var
restarting the server leaves you where you started (log is off)
For more information, see
http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_general_log