今天开发问我,mysql有无操作日志可查,查了下手册,还真有,不过默认情况下是没有开启的,开启步骤如下:
1,在/etc/my.cnf mysqld后面添加log = /var/lib/mysql/mysql.log
2,重启mysql
3,验证是否正常
[root@youxia64 ~]# mysql -uroot -p123456 abc;
Welcome to the MySQL monitor.
Your MySQL connection id is 2
Server version: 5.1.24-rc-community-log MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> select * from Account limit 1;
+-------+-------------------------------------+--------+-------+----------------+---------------------+---------------------+--------+-----------+---------+------+--------+----------+------------+
| accId | accName
+-------+-------------------------------------+--------+-------+----------------+---------------------+---------------------+--------+-----------+---------+------+--------+----------+------------+
|
+-------+-------------------------------------+--------+-------+----------------+---------------------+---------------------+--------+-----------+---------+------+--------+----------+------------+
1 row in set (0.00 sec)
mysql>
[root@web mysql]# cat mysql.log
/usr/sbin/mysqld, Version: 5.1.24-rc-community-log (MySQL Community Server (GPL)). started with:
Tcp port: 3306
Time
100309 11:14:18
100309 11:14:19