Mysql隐藏的风险文件

 

Mysql隐藏的风险文件 有两个

 

1:.mysql_history 文件,记录mysql在主机的所有操作(包括有密码修改等)

2:.mysql_secret 文件,记录初始的root密码

--在安装mysql用户的当前目录下,查看两个文件
[root@hostmysql-m ~]# ll .mysql*
-rw------- 1 root root 33830 Oct 25 11:49 .mysql_history
-rw------- 1 root root   104 Aug  8 14:03 .mysql_secret

--查看.mysql_history 为mysql在主机的所有操作记录
[root@hostmysql-m ~]# tail -10 .mysql_history
exit
use\040flydb;
set\040session\040tx_isolation='REPEATABLE-READ';
update\040test_record_lock_ukindex_table\040set\040score=100\040where\040name='bbb';
commit;
select\040*\040fromtest_record_lock_ukindex_table;
select\040*\040from\040test_record_lock_ukindex_table;
update\040test_nextkey_lock_noindex_table\040set\040score=100\040where\040name='bbb';
select\040*\040from\040test_nextkey_lock_noindex_table;
exit

--查看.mysql_secret 为mysql数据库root用户的初始化密码
[root@hostmysql-m ~]# tail -10 .mysql_secret
# The random password set for the root user at Wed Aug  8 14:03:21 2018 (local time): fN8zc2bEDhhXW4IJ

--清除这两个风险的文件

--清除.mysql_history文件内容   官网:https://dev.mysql.com/doc/refman/5.7/en/mysql-logging.html
[root@hostmysql-m ~]#  rm ~/.mysql_history               
rm: remove regular file `/root/.mysql_history'? yes
--创建软连接指向空
[root@hostmysql-m ~]# ln -s /dev/null ~/.mysql_history
--查看软连接建立成功
[root@hostmysql-m ~]# ls -al | grep mysql_history
lrwxrwxrwx   1 root root     9 Oct 26 16:30 .mysql_history -> /dev/null
--再次登录时,.mysql_history文件不记录任何记录
[root@hostmysql-m ~]# cat .mysql_history
[root@hostmysql-m ~]#

--清除.mysql_secret文件内容,直接删除即可
[root@hostmysql-m ~]# rm ~/.mysql_secret

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值