转 怎么看mysql 的历史登陆情况

https://serverfault.com/questions/496216/viewing-usage-history-in-mysql

Viewing usage history in MySQL

Q:

We have Ubuntu 11.10 server that is running a LAMP stack, it was set up before I got here and no one knows what its for. I have to migrate it, or just shut it down but I need to know what its doing first.

Digging through it, there are no sites hosted off of it however there several databases created in MySQL.

So it may be connected to one of our sites but none of the devs here know.

What I need to do is view connection history on the MySQL databases do that I can find what, if anything, is connecting to them.

I am monitoring the processlist and not seeing any active connections.

A:

Mysql login logs can be enabled by starting mysql server with the option --log="log-file" option.

/usr/bin/safe_mysqld --log="/var/lib/mysql/mysql.log" &

Mysql log will be logged inside the file /var/lib/mysql/mysql.log. tail this file to see the logs. To see only the login (connect log) use the following command

grep Connect /var/lib/mysql/mysql.log

炊烟起了;夕阳下了;细雨来了 多调试,交互式编程体验 记录,独立思考,对比 感谢转载作者 修车 国产化 read and connect 匍匐前进, 讲故事
原文地址:https://www.cnblogs.com/feiyun8616/p/14398863.html