1、首先找到MySQL的配置文件,在[mysqld]下添加
2、general_log_file=~/
3、同時,登錄MySQL console中設置打開log
4、mysql -uroot
5、> SET global general_log = 1;
6、重啟MySQL之後就可以在當前用户的HOME目錄中通過查看SQL日誌了。