安装了mysql之后,在root家目录下会存在一个.mysql_history文件
[root@potato ~]# ll -a|grep .mysql_history
-rw-------. 1 root root 1472 Dec 9 00:07 .mysql_history
root@potato ~]# tail -20 .mysql_history
show\040global\040variables\040like\040'%slow%';
show\040global\040variables\040like\040'%long%';
........
瞧,里面保存了我们之前所有执行过的语句
ps:这时出现\040转义字符出错的问题吧,应该是空格
为什么会产生这个文件呢,其目的是为了实现在mysql命令能够上下翻
每次mysql连接退出后,都会把此次操作的信息记录到~/.mysql_history文件中
可是,我们的所有操作都在里面,要是有人用非法入侵看到这个文件呢???
所以这个文件的存在对我们数据库产生了一定的威胁,那怎么处理它呢?
其实也很简单
将.mysql_history作为/dev/null的软连接,这样相当于所以的语句都输出到/dev/null
[root@potato ~]# ln -f -s /dev/null ~/.mysql_history
[root@potato ~]# cat .mysql_history
.mysql_history 成为了一个空文件
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31386161/viewspace-2130174/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/31386161/viewspace-2130174/