默认存在在数据目录下
[root@localhost mysql]# ls
auto.cnf ib_logfile0 king mysql mysql_bin.000002 mysql_bin.000004mysql_bin.index performance_schema utf8
ibdata1 ib_logfile1 localhost.localdomain.pid mysql_bin.000001 mysql_bin.000003 mysql_bin.000005mysql.sock test world
mysql> set global general_log=1;
Query OK,0 rows affected (0.07sec)
[root@localhost mysql]# ls
auto.cnf ib_logfile0 king localhost.log mysql_bin.000001 mysql_bin.000003 mysql_bin.000005mysql.sock test world
ibdata1 ib_logfile1 localhost.localdomain.pid mysql mysql_bin.000002 mysql_bin.000004 mysql_bin.index performance_schema utf8
[root@localhost mysql]# tail -flocalhost.log --查看查询日志 -f实时显示查看
/usr/local/mysql/bin/mysqld, Version: 5.6.23-log (MySQL Community Server (GPL)). started with:
Tcp port: 3306 Unix socket: /var/lib/mysql/mysql.sock
Time Id Command Argument
160328 10:39:24 4 Queryshow databases
160328 10:39:31 4 QuerySELECT DATABASE()
4 Init DBworld
4 Queryshow databases
4 Queryshow tables
160328 10:39:37 4 Queryshow tables
160328 10:39:43 4 QuerySELECT DATABASE()
4 Init DBking
4 Queryshow databases
4 Queryshow tables
4 Field Listb
4 Field Listpet
4 Field Liststudent
4 Field Listt
4 Field Listtest
4 Field Listw
160328 10:39:46 4 Queryshow tables
160328 10:39:58 4 Queryselect * from student
160328 10:40:53 4 Querydesc t
160328 10:43:08 4 Query set global general_log=0
mysql> set global general_log=0;
Query OK, 0 rows affected (0.01 sec)