原因
服务器公网ip,mysql用户和密码暴露在github上
修补和预防
-
更换公网ip(让之前的记录失效)
-
重新部署mysql(防止病毒留存)
-
修改mysql强密码
docker sudo docker exec -it mysql bin/bash 首先登录MySQL。 mysql -u root -p 2、修改密码 mysql> USE mysql; -- 切换到 mysql DB mysql> select Host,User,authentication_string,password_expired,password_last_changed from user; 查看表 mysql> update mysql.user set authentication_string=password('123456') where user='root' and Host = 'localhost'; 一定要用password()函数修改密码,如果还是按老版本修改密码方式会有问题。 mysql> update mysql.user set Host = '%' where user='root'; 把localhost改为%,是为了远程连接准备,允许所有ip访问 mysql> grant all on *.* to root@'%' identified by 'yourpassword'; 给数据库操作权限,例如增/删/改/查,all表示全部权限。 mysql> flush privileges; --不重启刷新,这步一定要操作
-
数据库sql初始化
-
后端配置信息统一配置到nacos(防止泄漏)
-
限制云服务器的IP访问(授权访问)