Edit your /etc/mysql/my.cnfand add the following at the end of the file :
[mysqld]
general_log_file = /var/log/mysql/mysql.log
general_log = 1
Connect through mysql (mysql -u -p) and run :
SET GLOBAL general_log = 1;
Restart mysql :
sudo service mysql restart
查看是否开启成功
show variables like 'general_log%';