mysql log开启_开启MySQL log

今天开发问我,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. Commands end with ; or \g.

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 | passwd | email | loginIp | createDttm | lastLoginDttm | status | partnerId | purview | cash | markId | serverId | unLockTime |

+-------+-------------------------------------+--------+-------+----------------+---------------------+---------------------+--------+-----------+---------+------+--------+----------+------------+

| 1 | 9ff37eb3806ad3c2f5f67327b280_120013 | | empty | 119.161.225.60 | 2009-07-29 11:20:27 | 2009-08-05 11:57:04 | 1 | 120013 | 0 | 0 | NULL | 0 | NULL |

+-------+-------------------------------------+--------+-------+----------------+---------------------+---------------------+--------+-----------+---------+------+--------+----------+------------+

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 Unix socket: /var/lib/mysql/mysql.sock

Time Id Command Argument

1 Query select @@version_comment limit 1

100309 11:14:18 1 Query select * from Account limit 1

100309 11:14:19 1 Quit

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值