MySQL——如何查看MySQL登录日志

前言

如需查看MySQL的登录日志,首先要确认开启了general_log

general_log会记录所有的SQL操作,一般不建议开启。

内容

查看general_log日志是否开启和存放目录

 show global variables like '%general%';

默认是以文件输出的,不输出到表格中。

查看登录日志信息

tail -f xxxxxx.log | grep "Connect"

开启general_log

set global general_log=on;
学无止境,谦卑而行.
原文地址:https://www.cnblogs.com/wangyang0210/p/14500827.html