东莞海天网站建设,网站调用微信数据,seo快速排名百度首页,如何优化seo默认情况下#xff0c;mysql的端口是3306#xff0c;超级用户是root#xff0c;很多情况下会被黑客扫描到#xff0c;成为肉鸡#xff08;作者以前就有过经理#xff09;#xff0c;数据库表直接丢失#xff0c;勒索我。
所以我这里介绍下#xff0c;更改默认端口mysql的端口是3306超级用户是root很多情况下会被黑客扫描到成为肉鸡作者以前就有过经理数据库表直接丢失勒索我。
所以我这里介绍下更改默认端口新增新用户来对指定数据库进行最小化的必要的操作权限的设置至于超级管理员root账号各位自行决定。
一更改默认端口
编辑 /etc/my.cnf 文件
在 [mysqld] 下新增
port端口号
如果已经有了 就修改操作
重启数据库
systemctl restart mysqld
二新增用户 密码 赋予权限
进入mysql数据库
mysql use mysql;mysql create user chushiyan0415192.168.0.150 identified by 123456;
mysql grant select on test.* to chushiyan0415192.168.0.150; 其中 test 为你要的数据库名称 替换你自己的 mysql show grants for chushiyan0415localhost; 可查看 当前新用户的权限 此时可看到 用户权限只有一个 select 因为上面我们只 grant select 给了新用户 chushiyan0415
grant insert on test.* to chushiyan0415192.168.0.150 ;
grant delete on test.* to chushiyan0415192.168.0.150 ;
grant update on test.* to chushiyan0415192.168.0.150 ;
grant select on test.* to chushiyan0415192.168.0.150 ;上面分别是 增改差删 权限给 新用户